Merge branch 'master' of http://gitlab.zcorp.cc/easycorp/zentaopms
This commit is contained in:
@@ -957,29 +957,30 @@ class productModel extends model
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @param string $orderBy
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getExecutionPairsByProduct($productID, $branch = 0, $orderBy = 'id_asc')
|
||||
public function getExecutionPairsByProduct($productID, $branch = 0, $orderBy = 'id_asc', $projectID = 0)
|
||||
{
|
||||
if(!$this->session->PRJ || !$productID) return array();
|
||||
if($productID) return array();
|
||||
if(empty($projectID)) return $this->getAllExecutionPairsByProduct($productID, $branch);
|
||||
|
||||
$project = $this->loadModel('program')->getPRJByID($this->session->PRJ);
|
||||
$project = $this->loadModel('program')->getPRJByID($projectID);
|
||||
$orderBy = $project->model == 'waterfall' ? 'begin_asc,id_asc' : 'begin_desc,id_desc';
|
||||
|
||||
$executions = $this->dao->select('t2.id,t2.name,t2.grade,t2.parent')->from(TABLE_PROJECTPRODUCT)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
->where('t1.product')->eq($productID)
|
||||
->andWhere('t2.project')->eq($this->session->PRJ)
|
||||
->andWhere('t2.project')->eq($projectID)
|
||||
->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi()
|
||||
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->sprints)->fi()
|
||||
->andWhere('t2.deleted')->eq('0')
|
||||
->orderBy($orderBy)
|
||||
->fetchAll('id');
|
||||
|
||||
$executionList = array('0' => '');
|
||||
|
||||
/* The waterfall project needs to show the hierarchy and remove the parent stage. */
|
||||
$executionList = array('0' => '');
|
||||
if($project->model == 'waterfall')
|
||||
{
|
||||
foreach($executions as $id => $execution)
|
||||
@@ -1010,6 +1011,54 @@ class productModel extends model
|
||||
return $executionList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get execution pairs by product.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $branch
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getAllExecutionPairsByProduct($productID, $branch = 0)
|
||||
{
|
||||
if(empty($productID)) return array();
|
||||
$executions = $this->dao->select('t2.id,t2.project,t2.name,t2.grade,t2.parent')->from(TABLE_PROJECTPRODUCT)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
->where('t1.product')->eq($productID)
|
||||
->andWhere('t2.type')->in('stage,sprint')
|
||||
->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi()
|
||||
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->sprints)->fi()
|
||||
->andWhere('t2.deleted')->eq('0')
|
||||
->fetchAll('id');
|
||||
|
||||
$projectIdList = array();
|
||||
foreach($executions as $id => $execution) $projectIdList[$execution->project] = $execution->project;
|
||||
|
||||
$executionPairs = array();
|
||||
$projectPairs = $this->loadModel('program')->getPRJPairsByIdList($projectIdList);
|
||||
foreach($executions as $id => $execution)
|
||||
{
|
||||
if($execution->grade == 2 && isset($executions[$execution->parent]))
|
||||
{
|
||||
$execution->name = $projectPairs[$execution->project] . '/' . $executions[$execution->parent]->name . '/' . $execution->name;
|
||||
$executions[$execution->parent]->children[$id] = $execution->name;
|
||||
unset($executions[$id]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($executions as $execution)
|
||||
{
|
||||
if(isset($execution->children))
|
||||
{
|
||||
$executionPairs = $executionPairs + $execution->children;
|
||||
continue;
|
||||
}
|
||||
$executionPairs[$execution->id] = $projectPairs[$execution->project] . '/' . $execution->name;
|
||||
}
|
||||
|
||||
return $executionPairs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get roadmap of a proejct.
|
||||
*
|
||||
|
||||
@@ -1745,7 +1745,7 @@ class programModel extends model
|
||||
{
|
||||
foreach($_POST['products'] as $productID => $product)
|
||||
{
|
||||
$this->dao->update(TABLE_PRODUCT)->set('program')->eq($newTopPGM)->where('id')->eq((int)$productID)->exec();
|
||||
$this->dao->update(TABLE_PRODUCT)->set('program')->eq((int)$newTopPGM)->where('id')->eq((int)$productID)->exec();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class testreportModel extends model
|
||||
{
|
||||
$data = fixer::input('post')
|
||||
->stripTags($this->config->testreport->editor->create['id'], $this->config->allowedTags)
|
||||
->add('PRJ', $this->session->PRJ)
|
||||
->setIF($this->lang->navGroup->testreport != 'qa', 'PRJ', $this->session->PRJ)
|
||||
->add('createdBy', $this->app->user->account)
|
||||
->add('createdDate', helper::now())
|
||||
->join('stories', ',')
|
||||
@@ -149,7 +149,7 @@ class testreportModel extends model
|
||||
{
|
||||
$objectID = (int)$objectID;
|
||||
return $this->dao->select('*')->from(TABLE_TESTREPORT)->where('deleted')->eq(0)
|
||||
->andWhere('PRJ')->eq($this->session->PRJ)
|
||||
->beginIF($this->lang->navGroup->testreport != 'qa')->andWhere('PRJ')->eq($this->session->PRJ)->fi()
|
||||
->beginIF($objectType == 'project')->andWhere('objectID')->eq($objectID)->andWhere('objectType')->eq('project')->fi()
|
||||
->beginIF($objectType == 'product' and $extra)->andWhere('objectID')->eq((int)$extra)->andWhere('objectType')->eq('testtask')->fi()
|
||||
->beginIF($objectType == 'product' and empty($extra))->andWhere('product')->eq($objectID)->fi()
|
||||
|
||||
@@ -101,7 +101,7 @@ class testsuiteModel extends model
|
||||
{
|
||||
$suite = fixer::input('post')
|
||||
->stripTags($this->config->testsuite->editor->create['id'], $this->config->allowedTags)
|
||||
->add('PRJ', $this->session->PRJ)
|
||||
->setIF($this->lang->navGroup->testsuite != 'qa', 'PRJ', $this->session->PRJ)
|
||||
->add('product', (int)$productID)
|
||||
->add('addedBy', $this->app->user->account)
|
||||
->add('addedDate', helper::now())
|
||||
@@ -133,7 +133,7 @@ class testsuiteModel extends model
|
||||
{
|
||||
return $this->dao->select("*")->from(TABLE_TESTSUITE)
|
||||
->where('product')->eq((int)$productID)
|
||||
->andWhere('PRJ')->eq($this->session->PRJ)
|
||||
->beginIF($this->lang->navGroup->testsuite != 'qa')->andWhere('PRJ')->eq($this->session->PRJ)->fi()
|
||||
->andWhere('deleted')->eq(0)
|
||||
->andWhere("(`type` = 'public' OR (`type` = 'private' and addedBy = '{$this->app->user->account}'))")
|
||||
->orderBy($orderBy)
|
||||
|
||||
@@ -305,7 +305,9 @@ class upgrade extends control
|
||||
$hourPoint = $this->loadModel('setting')->getItem('owner=system&module=custom&key=hourPoint');
|
||||
if(empty($hourPoint)) $this->setting->setItem('system.custom.hourPoint', 0);
|
||||
|
||||
$this->dao->update(TABLE_ACTION)->set('objectType')->eq('execution')->where('objectType')->eq('project')->exec();
|
||||
/* Update sprints history. */
|
||||
$sprints = $this->dao->select('id')->from(TABLE_PROJECT)->where('type')->eq('sprint')->fetchAll('id');
|
||||
$this->dao->update(TABLE_ACTION)->set('objectType')->eq('execution')->where('objectID')->in(array_keys($sprints))->andWhere('objectType')->eq('project')->exec();
|
||||
die(js::locate($this->createLink('upgrade', 'mergeRepo')));
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,10 @@ $(function()
|
||||
$('.lineBox').addClass('hidden');
|
||||
$(target).removeClass('hidden');
|
||||
$('#source').find('.lineBox :checkBox').prop('checked', false);
|
||||
$(target).find(":checkbox").prop('checked', true);
|
||||
|
||||
/* The first group of products is selected by default. */
|
||||
var firstProduct = $(target).find(":checkbox:first").prop('checked', true);
|
||||
$('[data-product=' + firstProduct.val() + ']').prop('checked', true);
|
||||
|
||||
/* Replace program name. */
|
||||
$('#PGMName').val($(this).text());
|
||||
|
||||
@@ -51,9 +51,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php $i ++;?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
<?php $i ++;?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user