Merge branch 'sprint/app10'
This commit is contained in:
+28
-33
@@ -9,42 +9,22 @@
|
||||
* @version 1
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class bugsEntry extends entry
|
||||
class bugsEntry extends entry
|
||||
{
|
||||
/**
|
||||
* GET method.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $projectID
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function get($productID = 0, $projectID = 0, $executionID = 0)
|
||||
public function get($productID = 0)
|
||||
{
|
||||
if(!$productID) $productID = $this->param('product', 0);
|
||||
if(!$projectID) $projectID = $this->param('project', 0);
|
||||
if(!$executionID) $executionID = $this->param('execution', 0);
|
||||
if(empty($productID)) $productID = $this->param('product', 0);
|
||||
if(empty($productID)) return $this->sendError(400, 'Need product id.');
|
||||
|
||||
if($projectID)
|
||||
{
|
||||
$control = $this->loadController('project', 'bug');
|
||||
$control->bug($projectID, $productID, $this->param('order', 'status,id_desc'), $this->param('build', 0), $this->param('status', 'all'), 0, $this->param('limit', 20), $this->param('page', 1));
|
||||
}
|
||||
elseif($executionID)
|
||||
{
|
||||
$control = $this->loadController('execution', 'bug');
|
||||
$control->bug($executionID, $productID, $this->param('order', 'status,id_desc'), $this->param('build', 0), $this->param('status', 'all'), 0, $this->param('limit', 20), $this->param('page', 1));
|
||||
}
|
||||
elseif($productID)
|
||||
{
|
||||
$control = $this->loadController('bug', 'browse');
|
||||
$control->browse($productID, $this->param('branch', ''), $this->param('status', ''), 0, $this->param('order', ''), 0, $this->param('limit', 20), $this->param('page', 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->sendError(400, 'Need product or project or execution id.');
|
||||
}
|
||||
$control = $this->loadController('bug', 'browse');
|
||||
$control->browse($productID, $this->param('branch', ''), $this->param('status', 'unclosed'), 0, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
|
||||
|
||||
$data = $this->getData();
|
||||
|
||||
@@ -55,16 +35,31 @@ class bugsEntry extends entry
|
||||
$result = array();
|
||||
foreach($bugs as $bug)
|
||||
{
|
||||
$result[] = $this->format($bug, 'activatedDate:time,openedDate:time,assignedDate:time,resolvedDate:time,closedDate:time,lastEditedDate:time,deadline:date,deleted:bool');
|
||||
$status = array('code' => $bug->status, 'name' => $this->lang->bug->statusList[$bug->status]);
|
||||
if($bug->status == 'active' and $bug->confirmed) $status = array('code' => 'confirmed', 'name' => $this->lang->bug->labelConfirmed);
|
||||
if($bug->resolution == 'postponed') $status = array('code' => 'postponed', 'name' => $this->lang->bug->labelPostponed);
|
||||
if(!empty($bug->delay)) $status = array('code' => 'delay', 'name' => $this->lang->bug->overdueBugs);
|
||||
$bug->status = $status;
|
||||
|
||||
$result[$bug->id] = $this->format($bug, 'activatedDate:time,openedDate:time,assignedDate:time,resolvedDate:time,closedDate:time,lastEditedDate:time,deadline:date,deleted:bool');
|
||||
}
|
||||
|
||||
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'bugs' => $result));
|
||||
$storyChangeds = $this->dao->select('t1.id')->from(TABLE_BUG)->alias('t1')
|
||||
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id')
|
||||
->where('t1.id')->in(array_keys($result))
|
||||
->andWhere('t1.story')->ne('0')
|
||||
->andWhere('t1.storyVersion != t2.version')
|
||||
->fetchPairs('id', 'id');
|
||||
foreach($storyChangeds as $bugID)
|
||||
{
|
||||
$status = array('code' => 'storyChanged', 'name' => $this->lang->bug->changed);
|
||||
$result[$bugID]->status = $status;
|
||||
}
|
||||
|
||||
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'bugs' => array_values($result)));
|
||||
}
|
||||
|
||||
if(isset($data->status) and $data->status == 'fail')
|
||||
{
|
||||
return $this->sendError(400, $data->message);
|
||||
}
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
return $this->sendError(400, 'error');
|
||||
}
|
||||
@@ -91,7 +86,7 @@ class bugsEntry extends entry
|
||||
$this->requireFields('title,pri,severity,type,openedBuild');
|
||||
|
||||
$control->create($productID);
|
||||
|
||||
|
||||
$data = $this->getData();
|
||||
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
|
||||
if(isset($data->result) and !isset($data->id)) return $this->sendError(400, $data->message);
|
||||
|
||||
@@ -20,10 +20,11 @@ class buildsEntry extends entry
|
||||
*/
|
||||
public function get($projectID = 0)
|
||||
{
|
||||
if(!$projectID) $projectID = $this->param('project', 0);
|
||||
if(empty($projectID)) $projectID = $this->param('project', 0);
|
||||
if(empty($projectID)) return $this->sendError(400, "Need project id.");
|
||||
|
||||
$control = $this->loadController('project', 'build');
|
||||
$control->build($projectID, $this->param('type', 'all'), $this->param('param', 0));
|
||||
$control->build($projectID, $this->param('type', 'all'), $this->param('param', 0), $this->param('order', 't1.date_desc,t1.id_desc'));
|
||||
$data = $this->getData();
|
||||
|
||||
if(!isset($data->status)) return $this->sendError(400, 'error');
|
||||
@@ -38,7 +39,7 @@ class buildsEntry extends entry
|
||||
}
|
||||
}
|
||||
|
||||
return $this->send(200, $result);
|
||||
return $this->send(200, array('total' => count($result), 'builds' => $result));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,11 +33,6 @@ class doclibsEntry extends Entry
|
||||
}
|
||||
krsort($result);
|
||||
|
||||
$lib = new stdclass();
|
||||
$lib->id = 'files';
|
||||
$lib->name = $this->lang->doclib->files;
|
||||
$result[] = $lib;
|
||||
|
||||
return $this->send(200, array('libs' => array_values($result)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* The meetings entry point of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
||||
* @package entries
|
||||
* @version 1
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class meetingsEntry extends entry
|
||||
{
|
||||
/**
|
||||
* GET method.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function get($projectID = 0)
|
||||
{
|
||||
if(empty($projectID)) $projectID = $this->param('project', 0);
|
||||
if(empty($projectID)) return $this->sendError(400, 'Need project id.');
|
||||
|
||||
$project = $this->loadModel('project')->getByID($projectID);
|
||||
if(!$project) return $this->send404();
|
||||
|
||||
/* Get meetings by project. */
|
||||
$control = $this->loadController('meeting', 'browse');
|
||||
$control->browse($projectID, $this->param('status', 'all'), '', $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
|
||||
$data = $this->getData();
|
||||
|
||||
if(!isset($data->status)) return $this->sendError(400, 'error');
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
$pager = $data->data->pager;
|
||||
$result = array();
|
||||
foreach($data->data->meetings as $risk)
|
||||
{
|
||||
$result[] = $this->format($risk, 'createdDate:time,editedDate:time');
|
||||
}
|
||||
|
||||
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'meetings' => $result));
|
||||
}
|
||||
|
||||
/**
|
||||
* POST method.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function post($projectID = 0)
|
||||
{
|
||||
$project = $this->loadModel('project')->getByID($projectID);
|
||||
if(!$project) return $this->send404();
|
||||
|
||||
$fields = 'source,name,category,strategy,status,impact,probability,rate,identifiedDate,plannedClosedDate,actualClosedDate,resolvedBy,assignedTo,prevention,remedy,resolution';
|
||||
$this->batchSetPost($fields);
|
||||
|
||||
$this->setPost('impact', $this->request('impact', 3));
|
||||
$this->setPost('probability', $this->request('probability', 3));
|
||||
$this->setPost('rate', $this->request('rate', 9));
|
||||
$this->setPost('pri', 'middle');
|
||||
|
||||
$control = $this->loadController('risk', 'create');
|
||||
$this->requireFields('name');
|
||||
|
||||
$control->create($projectID);
|
||||
|
||||
$data = $this->getData();
|
||||
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
|
||||
if(isset($data->result) and !isset($data->id)) return $this->sendError(400, $data->message);
|
||||
|
||||
$risk = $this->loadModel('risk')->getByID($data->id);
|
||||
|
||||
$this->send(201, $this->format($risk, 'createdDate:time,editedDate:time'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/**
|
||||
* The product projects entry point of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
||||
* @package entries
|
||||
* @version 1
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class productProjectsEntry extends entry
|
||||
{
|
||||
/**
|
||||
* GET method.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function get($productID = 0)
|
||||
{
|
||||
if(empty($productID)) $productID = $this->param('product', 0);
|
||||
if(empty($productID)) return $this->sendError('400', "Need product id");
|
||||
$appendFields = $this->param('fields', '');
|
||||
|
||||
$control = $this->loadController('product', 'project');
|
||||
$control->project($this->param('status', 'all'), $productID, $this->param('branch', 0), $this->param('involved', 0), $this->param('order', 'order_desc'));
|
||||
$data = $this->getData();
|
||||
|
||||
if(isset($data->status) and $data->status == 'success')
|
||||
{
|
||||
$result = array();
|
||||
foreach($data->data->projectStats as $project)
|
||||
{
|
||||
foreach($project->hours as $field => $value) $project->$field = $value;
|
||||
|
||||
$project = $this->filterFields($project, 'id,name,code,model,type,budget,budgetUnit,parent,begin,end,status,openedBy,openedDate,PM,delay,progress,' . $appendFields);
|
||||
$result[] = $this->format($project, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time');
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['total'] = count($result);
|
||||
$data['projects'] = $result;
|
||||
|
||||
$withUser = $this->param('withUser', '');
|
||||
if(!empty($withUser)) $data['users'] = $users;
|
||||
|
||||
return $this->send(200, $data);
|
||||
}
|
||||
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
// TODO There is no handle for 401.
|
||||
return $this->sendError(400, 'error');
|
||||
}
|
||||
|
||||
/**
|
||||
* POST method.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function post()
|
||||
{
|
||||
$fields = 'name,begin,end,products';
|
||||
$this->batchSetPost($fields);
|
||||
|
||||
$this->setPost('code', $this->request('code', ''));
|
||||
$this->setPost('acl', $this->request('acl', 'private'));
|
||||
$this->setPost('parent', $this->request('program', 0));
|
||||
$this->setPost('whitelist', $this->request('whitelist', array()));
|
||||
$this->setPost('PM', $this->request('PM', ''));
|
||||
$this->setPost('model', $this->request('model', 'scrum'));
|
||||
|
||||
$control = $this->loadController('project', 'create');
|
||||
$this->requireFields('name,code,begin,end,products');
|
||||
|
||||
$control->create($this->request('model', 'scrum'));
|
||||
|
||||
$data = $this->getData();
|
||||
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
|
||||
if(!isset($data->result)) return $this->sendError(400, 'error');
|
||||
|
||||
$project = $this->loadModel('project')->getByID($data->id);
|
||||
|
||||
$this->send(201, $this->format($project, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get drop menu.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getDropMenu()
|
||||
{
|
||||
$control = $this->loadController('project', 'ajaxGetDropMenu');
|
||||
$control->ajaxGetDropMenu($this->request('projectID', 0), $this->request('module', 'project'), $this->request('method', 'browse'));
|
||||
|
||||
$data = $this->getData();
|
||||
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
$dropMenu = array('owner' => array(), 'other' => array(), 'closed' => array());
|
||||
foreach($data->data->projects as $programID => $projects)
|
||||
{
|
||||
foreach($projects as $project)
|
||||
{
|
||||
if(helper::diffDate(date('Y-m-d'), $project->end) > 0) $project->delay = true;
|
||||
$project = $this->filterFields($project, 'id,model,type,name,code,parent,status,PM,delay');
|
||||
|
||||
if($project->status == 'closed')
|
||||
{
|
||||
$dropMenu['closed'][] = $project;
|
||||
}
|
||||
elseif($project->PM == $this->app->user->account)
|
||||
{
|
||||
$dropMenu['owner'][] = $project;
|
||||
}
|
||||
else
|
||||
{
|
||||
$dropMenu['other'][] = $project;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->send(200, $dropMenu);
|
||||
}
|
||||
}
|
||||
@@ -32,13 +32,13 @@ class programsEntry extends Entry
|
||||
if(!$data or !isset($data->status)) return $this->sendError(400, 'error');
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
$programs = (array)$data->data->programs;
|
||||
$progressList = (array)$data->data->progressList;
|
||||
$programs = $data->data->programs;
|
||||
$progressList = $data->data->progressList;
|
||||
$users = $data->data->users;
|
||||
$result = array();
|
||||
foreach($programs as $program)
|
||||
{
|
||||
if(isset($progressList[$program->id])) $program->progress = $progressList[$program->id];
|
||||
if(isset($progressList->{$program->id})) $program->progress = $progressList->{$program->id};
|
||||
$param = $this->format($program, 'begin:date,end:date,realBegan:date,realEnd:date,openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time,deleted:bool');
|
||||
|
||||
if($mergeChildren)
|
||||
@@ -57,9 +57,9 @@ class programsEntry extends Entry
|
||||
$program->labelBudget = $program->budget != 0 ? zget($this->lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $this->lang->project->future;
|
||||
|
||||
if(empty($program->parent)) $result[$program->id] = $program;
|
||||
if(isset($programs[$program->parent]))
|
||||
if(isset($programs->{$program->parent}))
|
||||
{
|
||||
$parentProgram = $programs[$program->parent];
|
||||
$parentProgram = $programs->{$program->parent};
|
||||
if(!isset($parentProgram->children)) $parentProgram->children = array();
|
||||
$parentProgram->children[] = $program;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,10 @@ class projectEntry extends entry
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
$project = $this->format($data->data->project, 'begin:date,end:date,realBegan:date,realEnd:date,openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time,deleted:bool');
|
||||
|
||||
$this->loadModel('testcase');
|
||||
$project->caseReview = ($this->config->testcase->needReview or !empty($this->config->testcase->forceReview));
|
||||
|
||||
if(empty($fields)) return $this->send(200, $project);
|
||||
|
||||
/* Set other fields. */
|
||||
|
||||
@@ -20,7 +20,7 @@ class projectBugsEntry extends entry
|
||||
*/
|
||||
public function get($projectID = 0)
|
||||
{
|
||||
if(!$projectID) $projectID = $this->param('project', 0);
|
||||
if(empty($projectID)) $projectID = $this->param('project', 0);
|
||||
if(empty($projectID)) return $this->sendError(400, 'Need project id.');
|
||||
|
||||
$control = $this->loadController('project', 'bug');
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* The project cases entry point of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
||||
* @package entries
|
||||
* @version 1
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class projectCasesEntry extends entry
|
||||
{
|
||||
/**
|
||||
* GET method.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function get($projectID = 0)
|
||||
{
|
||||
if(!$projectID) $projectID = $this->param('project', 0);
|
||||
if(empty($projectID)) return $this->sendError(400, 'Need project id.');
|
||||
|
||||
$this->app->tab = 'project';
|
||||
$this->app->session->set('project', $projectID, $this->app->tab);
|
||||
|
||||
$control = $this->loadController('project', 'testcase');
|
||||
$control->testcase($projectID, $this->param('product', 0), $this->param('branch', 0), $this->param('status', 'all'), 0, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
|
||||
|
||||
$data = $this->getData();
|
||||
|
||||
if(isset($data->status) and $data->status == 'success')
|
||||
{
|
||||
$cases = $data->data->cases;
|
||||
$pager = $data->data->pager;
|
||||
$result = array();
|
||||
foreach($cases as $case)
|
||||
{
|
||||
$case->status = array('code' => $case->status, 'name' => $this->lang->testcase->statusList[$case->status]);
|
||||
$result[] = $this->format($case, 'openedDate:time,reviewedDate:date,lastEditedDate:time,lastRunDate:time');
|
||||
}
|
||||
|
||||
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'cases' => $result));
|
||||
}
|
||||
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
return $this->sendError(400, 'error');
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
* @version 1
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class projectreleasesEntry extends entry
|
||||
class projectReleasesEntry extends entry
|
||||
{
|
||||
/**
|
||||
* GET method.
|
||||
@@ -20,7 +20,26 @@ class projectreleasesEntry extends entry
|
||||
*/
|
||||
public function get($projectID = 0)
|
||||
{
|
||||
$this->fetch('releases', 'get', array('productID' => 0, 'projectID' => $projectID));
|
||||
if(empty($projectID)) $projectID = $this->param('project');
|
||||
if(empty($projectID)) return $this->sendError(400, 'Need project id.');
|
||||
|
||||
$control = $this->loadController('projectrelease', 'browse');
|
||||
$control->browse($projectID, $this->param('execution', 0), $this->param('status', 'all'), $this->param('order', 't1.date_desc'));
|
||||
|
||||
/* 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');
|
||||
|
||||
return $this->send(200, array('total' => count($result), 'releases' => $result));
|
||||
}
|
||||
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
return $this->sendError(400, 'error');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,26 +15,16 @@ class releasesEntry extends entry
|
||||
* GET method.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function get($productID = 0, $projectID = 0)
|
||||
public function get($productID = 0)
|
||||
{
|
||||
if(!$productID) $productID = $this->param('product');
|
||||
if(!$projectID) $projectID = $this->param('project');
|
||||
if(!$productID and !$projectID) return $this->sendError(400, 'Need product or project id.');
|
||||
if(empty($productID)) $productID = $this->param('product');
|
||||
if(empty($productID)) return $this->sendError(400, 'Need product id.');
|
||||
|
||||
if($projectID)
|
||||
{
|
||||
$control = $this->loadController('projectrelease', 'browse');
|
||||
$control->browse($projectID, 0, $this->param('status', 'all'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$control = $this->loadController('release', 'browse');
|
||||
$control->browse($productID, $this->param('branch', 0), $this->param('status', 'all'));
|
||||
}
|
||||
$control = $this->loadController('release', 'browse');
|
||||
$control->browse($productID, $this->param('branch', 0), $this->param('status', 'all'), $this->param('order', 't1.date_desc'));
|
||||
|
||||
/* Response */
|
||||
$data = $this->getData();
|
||||
@@ -44,7 +34,7 @@ class releasesEntry extends entry
|
||||
$releases = $data->data->releases;
|
||||
foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date');
|
||||
|
||||
return $this->send(200, array('releases' => $result));
|
||||
return $this->send(200, array('total' => count($result), 'releases' => $result));
|
||||
}
|
||||
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
@@ -15,28 +15,16 @@ class testcasesEntry extends entry
|
||||
* GET method.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $projectID
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function get($productID = 0, $projectID = 0, $executionID = 0)
|
||||
public function get($productID = 0)
|
||||
{
|
||||
if(!$productID) $productID = $this->param('product', 0);
|
||||
if(!$projectID) $projectID = $this->param('project', 0);
|
||||
if(!$executionID) $executionID = $this->param('execution', 0);
|
||||
if(!$productID and !$projectID and !$executionID) return $this->sendError(400, 'Need product or project or execution id.');
|
||||
if(empty($productID)) $productID = $this->param('product', 0);
|
||||
if(empty($productID)) return $this->sendError(400, 'Need product id.');
|
||||
|
||||
if($executionID)
|
||||
{
|
||||
$control = $this->loadController('execution', 'testcase');
|
||||
$control->testcase($executionID, $this->param('status', 'all'), $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
$control = $this->loadController('testcase', 'browse');
|
||||
$control->browse($productID, $this->param('branch', ''), $this->param('status', 'all'), 0, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1), $projectID);
|
||||
}
|
||||
$control = $this->loadController('testcase', 'browse');
|
||||
$control->browse($productID, $this->param('branch', ''), $this->param('status', 'all'), 0, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1), $projectID);
|
||||
|
||||
$data = $this->getData();
|
||||
|
||||
|
||||
+13
-7
@@ -28,8 +28,8 @@ $routes['/products/:id/plans'] = 'productPlans';
|
||||
$routes['/productplans/:id'] = 'productPlan';
|
||||
|
||||
$routes['/releases'] = 'releases';
|
||||
$routes['/product/:id/releases'] = 'releases';
|
||||
$routes['/projects/:id/releases'] = 'projectreleases';
|
||||
$routes['/products/:id/releases'] = 'releases';
|
||||
$routes['/projects/:id/releases'] = 'projectReleases';
|
||||
$routes['/releases/:id'] = 'release';
|
||||
|
||||
$routes['/stories'] = 'stories';
|
||||
@@ -46,6 +46,7 @@ $routes['/bugs'] = 'bugs';
|
||||
$routes['/bugs/:id'] = 'bug';
|
||||
|
||||
$routes['/programs/:id/projects'] = 'projects';
|
||||
$routes['/products/:id/projects'] = 'productProjects';
|
||||
$routes['/projects'] = 'projects';
|
||||
$routes['/projects/:id'] = 'project';
|
||||
|
||||
@@ -69,10 +70,10 @@ $routes['/programs/:id'] = 'program';
|
||||
|
||||
$routes['/programs/:id/stakeholders'] = 'stakeholders';
|
||||
|
||||
$routes['/products/:productID/issues'] = 'productIssues';
|
||||
$routes['/projects/:projectID/issues'] = 'issues';
|
||||
$routes['/issues'] = 'issues';
|
||||
$routes['/issues/:issueID'] = 'issue';
|
||||
$routes['/products/:id/issues'] = 'productIssues';
|
||||
$routes['/projects/:id/issues'] = 'issues';
|
||||
$routes['/issues'] = 'issues';
|
||||
$routes['/issues/:issueID'] = 'issue';
|
||||
|
||||
$routes['/todos'] = 'todos';
|
||||
$routes['/todos/:id'] = 'todo';
|
||||
@@ -84,7 +85,8 @@ $routes['/builds'] = 'builds';
|
||||
$routes['/builds/:id'] = 'build';
|
||||
|
||||
$routes['/products/:id/testcases'] = 'testcases';
|
||||
$routes['/executions/:id/testcases'] = 'executioncases';
|
||||
$routes['/projects/:id/testcases'] = 'projectCases';
|
||||
$routes['/executions/:id/testcases'] = 'executionCases';
|
||||
$routes['/testcases'] = 'testcases';
|
||||
$routes['/testcases/:id'] = 'testcase';
|
||||
|
||||
@@ -96,6 +98,10 @@ $routes['/projects/:projectID/risks'] = 'risks';
|
||||
$routes['/risks'] = 'risks';
|
||||
$routes['/risks/:id'] = 'risk';
|
||||
|
||||
$routes['/projects/:id/meetings'] = 'meetings';
|
||||
$routes['/meetings'] = 'meetings';
|
||||
$routes['/meetings/:id'] = 'meeting';
|
||||
|
||||
$routes['/departments'] = 'departments';
|
||||
$routes['/departments/:id'] = 'department';
|
||||
|
||||
|
||||
@@ -55,10 +55,11 @@ class buildModel extends model
|
||||
* @param int $projectID
|
||||
* @param string $type
|
||||
* @param int $param
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectBuilds($projectID = 0, $type = 'all', $param = 0)
|
||||
public function getProjectBuilds($projectID = 0, $type = 'all', $param = 0, $orderBy = 't1.date_desc,t1.id_desc')
|
||||
{
|
||||
return $this->dao->select('t1.*, t2.name as executionName, t2.id as executionID, t3.name as productName, t4.name as branchName')
|
||||
->from(TABLE_BUILD)->alias('t1')
|
||||
@@ -70,7 +71,7 @@ class buildModel extends model
|
||||
->andWhere('t1.project')->ne(0)
|
||||
->beginIF($type == 'product' and $param)->andWhere('t1.product')->eq($param)->fi()
|
||||
->beginIF($type == 'bysearch')->andWhere($param)->fi()
|
||||
->orderBy('t1.date DESC, t1.id desc')
|
||||
->orderBy($orderBy)
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
|
||||
@@ -69,14 +69,15 @@ class product extends control
|
||||
/**
|
||||
* The projects which linked the product.
|
||||
*
|
||||
* @param string $status
|
||||
* @param int $productID
|
||||
* @param int|string $branch
|
||||
* @param int $involved
|
||||
* @param string $status
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param int $involved
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function project($status = 'all', $productID = 0, $branch = '', $involved = 0)
|
||||
public function project($status = 'all', $productID = 0, $branch = '', $involved = 0, $orderBy = 'order_desc')
|
||||
{
|
||||
$this->app->loadLang('execution');
|
||||
$this->app->loadLang('project');
|
||||
@@ -88,7 +89,7 @@ class product extends control
|
||||
|
||||
/* Get PM id list. */
|
||||
$accounts = array();
|
||||
$projectStats = $this->product->getProjectStatsByProduct($productID, $status, $branch, $involved);
|
||||
$projectStats = $this->product->getProjectStatsByProduct($productID, $status, $branch, $involved, $orderBy);
|
||||
|
||||
foreach($projectStats as $project)
|
||||
{
|
||||
|
||||
@@ -958,10 +958,11 @@ class productModel extends model
|
||||
* @param string $browseType
|
||||
* @param int $branch
|
||||
* @param int $involved
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectListByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0)
|
||||
public function getProjectListByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0, $orderBy = 'order_desc')
|
||||
{
|
||||
$projectList = $this->dao->select('t2.*')->from(TABLE_PROJECTPRODUCT)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
@@ -978,6 +979,7 @@ class productModel extends model
|
||||
->fi()
|
||||
->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi()
|
||||
->andWhere('t2.deleted')->eq('0')
|
||||
->orderBy($orderBy)
|
||||
->fetchAll('id');
|
||||
|
||||
/* Determine how to display the name of the program. */
|
||||
@@ -998,12 +1000,13 @@ class productModel extends model
|
||||
* @param string $browseType
|
||||
* @param int $branch
|
||||
* @param int $involved
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectStatsByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0)
|
||||
public function getProjectStatsByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0, $orderBy = 'order_desc')
|
||||
{
|
||||
$projects = $this->getProjectListByProduct($productID, $browseType, $branch, $involved);
|
||||
$projects = $this->getProjectListByProduct($productID, $browseType, $branch, $involved, $orderBy);
|
||||
if(empty($projects)) return array();
|
||||
|
||||
$projectKeys = array_keys($projects);
|
||||
|
||||
+21
-34
@@ -440,43 +440,30 @@ class programModel extends model
|
||||
$path = $program->path;
|
||||
}
|
||||
|
||||
$projectList = $this->dao->select('*')->from(TABLE_PROJECT)
|
||||
->where('deleted')->eq('0')
|
||||
->beginIF($this->config->systemMode == 'new')->andWhere('type')->eq('project')->fi()
|
||||
->beginIF($browseType != 'all' and $browseType != 'undone')->andWhere('status')->eq($browseType)->fi()
|
||||
->beginIF($browseType == 'undone')->andWhere('status')->in('wait,doing')->fi()
|
||||
->beginIF($path)->andWhere('path')->like($path . '%')->fi()
|
||||
->beginIF(!$queryAll and !$this->app->user->admin and $this->config->systemMode == 'new')->andWhere('id')->in($this->app->user->view->projects)->fi()
|
||||
->beginIF(!$queryAll and !$this->app->user->admin and $this->config->systemMode == 'classic')->andWhere('id')->in($this->app->user->view->sprints)->fi()
|
||||
$projectList = $this->dao->select('distinct t1.*')->from(TABLE_PROJECT)->alias('t1')
|
||||
->leftJoin(TABLE_TEAM)->alias('t2')->on('t1.id=t2.root')
|
||||
->leftJoin(TABLE_STAKEHOLDER)->alias('t3')->on('t1.id=t3.objectID')
|
||||
->where('t1.deleted')->eq('0')
|
||||
->beginIF($this->config->systemMode == 'new')->andWhere('t1.type')->eq('project')->fi()
|
||||
->beginIF($this->config->systemMode == 'new' and ($this->cookie->involved or $involved))->andWhere('t2.type')->eq('project')->fi()
|
||||
->beginIF($this->config->systemMode == 'new' and ($this->cookie->involved or $involved))->andWhere('t3.objectType')->eq('project')->fi()
|
||||
->beginIF($browseType != 'all' and $browseType != 'undone')->andWhere('t1.status')->eq($browseType)->fi()
|
||||
->beginIF($browseType == 'undone')->andWhere('t1.status')->in('wait,doing')->fi()
|
||||
->beginIF($path)->andWhere('t1.path')->like($path . '%')->fi()
|
||||
->beginIF(!$queryAll and !$this->app->user->admin and $this->config->systemMode == 'new')->andWhere('t1.id')->in($this->app->user->view->projects)->fi()
|
||||
->beginIF(!$queryAll and !$this->app->user->admin and $this->config->systemMode == 'classic')->andWhere('t1.id')->in($this->app->user->view->sprints)->fi()
|
||||
->beginIF($this->cookie->involved or $involved)
|
||||
->andWhere('t1.openedBy', true)->eq($this->app->user->account)
|
||||
->orWhere('t1.PM')->eq($this->app->user->account)
|
||||
->orWhere('t2.account')->eq($this->app->user->account)
|
||||
->orWhere('t3.user')->eq($this->app->user->account)
|
||||
->orWhere("CONCAT(',', t1.whitelist, ',')")->like("%,{$this->app->user->account},%")
|
||||
->markRight(1)
|
||||
->fi()
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->page($pager, 't1.id')
|
||||
->fetchAll('id');
|
||||
|
||||
if($this->cookie->involved or $involved)
|
||||
{
|
||||
$stakeholderGroup = $this->dao->select('objectID,user')->from(TABLE_STAKEHOLDER)
|
||||
->where('deleted')->eq('0')
|
||||
->andWhere('objectID')->in(array_keys($projectList))
|
||||
->fetchGroup('objectID', 'user');
|
||||
|
||||
$teamMembersGroup = $this->dao->select('root,account')->from(TABLE_TEAM)
|
||||
->where('root')->in(array_keys($projectList))
|
||||
->fetchGroup('root','account');
|
||||
|
||||
foreach($projectList as $id => $project)
|
||||
{
|
||||
$whitelist = explode(",", $project->whitelist);
|
||||
if($project->openedBy == $this->app->user->account) continue;
|
||||
if($project->PM == $this->app->user->account) continue;
|
||||
if(in_array($this->app->user->account, $whitelist)) continue;
|
||||
if(isset($teamMembersGroup[$project->id][$this->app->user->account])) continue;
|
||||
if(isset($stakeholderGroup[$project->id][$this->app->user->account])) continue;
|
||||
|
||||
unset($projectList[$id]);
|
||||
$pager->recTotal -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Determine how to display the name of the program. */
|
||||
if($programTitle and $this->config->systemMode == 'new')
|
||||
{
|
||||
|
||||
@@ -1039,12 +1039,14 @@ class project extends control
|
||||
/**
|
||||
* Browse builds of a project.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $type all|product|bysearch
|
||||
* @param int $param
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function build($projectID = 0, $type = 'all', $param = 0)
|
||||
public function build($projectID = 0, $type = 'all', $param = 0, $orderBy = 't1.date_desc,t1.id_desc')
|
||||
{
|
||||
/* Load module and get project. */
|
||||
$this->loadModel('build');
|
||||
@@ -1071,11 +1073,11 @@ class project extends control
|
||||
|
||||
if($type == 'bysearch')
|
||||
{
|
||||
$builds = $this->build->getProjectBuildsBySearch((int)$projectID, (int)$param);
|
||||
$builds = $this->build->getProjectBuildsBySearch((int)$projectID, (int)$param, $orderBy);
|
||||
}
|
||||
else
|
||||
{
|
||||
$builds = $this->build->getProjectBuilds((int)$projectID, $type, $param);
|
||||
$builds = $this->build->getProjectBuilds((int)$projectID, $type, $param, $orderBy);
|
||||
}
|
||||
|
||||
/* Set project builds. */
|
||||
|
||||
@@ -62,10 +62,11 @@ class projectrelease extends control
|
||||
* @param int $projectID
|
||||
* @param int $executionID
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browse($projectID = 0, $executionID = 0, $type = 'all')
|
||||
public function browse($projectID = 0, $executionID = 0, $type = 'all', $orderBy = 't1.date_desc')
|
||||
{
|
||||
$this->session->set('releaseList', $this->app->getURI(true), 'project');
|
||||
$project = $this->project->getById($projectID);
|
||||
@@ -81,7 +82,7 @@ class projectrelease extends control
|
||||
$this->view->execution = $execution;
|
||||
$this->view->project = $project;
|
||||
$this->view->products = $this->loadModel('product')->getProducts($projectID);
|
||||
$this->view->releases = $this->projectrelease->getList($projectID, $type);
|
||||
$this->view->releases = $this->projectrelease->getList($projectID, $type, $orderBy);
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->executionID = $executionID;
|
||||
$this->view->type = $type;
|
||||
|
||||
@@ -45,10 +45,11 @@ class projectreleaseModel extends model
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getList($projectID, $type = 'all')
|
||||
public function getList($projectID, $type = 'all', $orderBy = 't1.date_desc')
|
||||
{
|
||||
return $this->dao->select('t1.*, t2.name as productName, t3.id as buildID, t3.name as buildName, t3.execution, t4.name as executionName')
|
||||
->from(TABLE_RELEASE)->alias('t1')
|
||||
@@ -58,7 +59,7 @@ class projectreleaseModel extends model
|
||||
->where('t1.project')->eq((int)$projectID)
|
||||
->beginIF($type != 'all')->andWhere('t1.status')->eq($type)->fi()
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->orderBy('t1.date DESC')
|
||||
->orderBy($orderBy)
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,20 +34,21 @@ class release extends control
|
||||
/**
|
||||
* Browse releases.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param string|int $branch
|
||||
* @param string $type
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browse($productID, $branch = 'all', $type = 'all')
|
||||
public function browse($productID, $branch = 'all', $type = 'all', $orderBy = 't1.date_desc')
|
||||
{
|
||||
$this->commonAction($productID, $branch);
|
||||
$this->session->set('releaseList', $this->app->getURI(true), 'product');
|
||||
|
||||
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->release->browse;
|
||||
$this->view->position[] = $this->lang->release->browse;
|
||||
$this->view->releases = $this->release->getList($productID, $branch, $type);
|
||||
$this->view->releases = $this->release->getList($productID, $branch, $type, $orderBy);
|
||||
$this->view->type = $type;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -43,13 +43,14 @@ class releaseModel extends model
|
||||
/**
|
||||
* Get list of releases.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param string|int $branch
|
||||
* @param string $type
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getList($productID, $branch = 'all', $type = 'all')
|
||||
public function getList($productID, $branch = 'all', $type = 'all', $orderBy = 't1.date_desc')
|
||||
{
|
||||
return $this->dao->select('t1.*, t2.name as productName, t3.id as buildID, t3.name as buildName, t3.project, t4.name as projectName')
|
||||
->from(TABLE_RELEASE)->alias('t1')
|
||||
@@ -60,7 +61,7 @@ class releaseModel extends model
|
||||
->beginIF($branch !== 'all')->andWhere('t1.branch')->eq($branch)->fi()
|
||||
->beginIF($type != 'all')->andWhere('t1.status')->eq($type)->fi()
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->orderBy('t1.date DESC')
|
||||
->orderBy($orderBy)
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ class searchModel extends model
|
||||
|
||||
if($hasUser)
|
||||
{
|
||||
$users = $this->loadModel('user')->getPairs('realname|noclosed', $appendUsers);
|
||||
$users = $this->loadModel('user')->getPairs('realname|noclosed', $appendUsers, $this->config->maxCount);
|
||||
$users['$@me'] = $this->lang->search->me;
|
||||
}
|
||||
if($hasProduct) $products = array('' => '') + $this->loadModel('product')->getPairs('', $this->session->project);
|
||||
|
||||
@@ -317,9 +317,8 @@ class testcaseModel extends model
|
||||
{
|
||||
return $this->dao->select('distinct t1.*, t2.*')->from(TABLE_PROJECTCASE)->alias('t1')
|
||||
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case=t2.id')
|
||||
->leftJoin(TABLE_STORY)->alias('t3')->on('t1.story = t3.id')
|
||||
->leftJoin(TABLE_STORY)->alias('t3')->on('t2.story = t3.id')
|
||||
->where('t1.project')->eq((int)$executionID)
|
||||
->beginIF($browseType != 'all')->andWhere('t2.status')->eq($browseType)->fi()
|
||||
->andWhere('t2.deleted')->eq('0')
|
||||
->andWhere('t3.version > t2.storyVersion')
|
||||
->andWhere("t3.status")->eq('active')
|
||||
|
||||
@@ -1253,6 +1253,7 @@ class user extends control
|
||||
$limit = $this->get->limit;
|
||||
$index = 0;
|
||||
$newUsers = array();
|
||||
if(empty($search)) return array();
|
||||
foreach($users as $account => $realname)
|
||||
{
|
||||
if($index >= $limit) break;
|
||||
|
||||
Reference in New Issue
Block a user