* Fix bugs.

This commit is contained in:
Yagami
2020-11-02 10:09:40 +08:00
parent a80fb13c7b
commit 18131e47ef
7 changed files with 20 additions and 20 deletions
+1 -2
View File
@@ -679,8 +679,7 @@ class block extends control
$type = isset($this->params->type) ? $this->params->type : 'assignedTo';
$orderBy = isset($this->params->type) ? $this->params->orderBy : 'id_asc';
$programID = $this->view->block->module == 'my' ? 0 : (int)$this->session->PRJ;
$this->view->stories = $this->loadModel('story')->getUserStories($this->app->user->account, $type, $orderBy, $this->viewType != 'json' ? $pager : '', 'story', $programID);
$this->view->stories = $this->loadModel('story')->getUserStories($this->app->user->account, $type, $orderBy, $this->viewType != 'json' ? $pager : '', 'story');
}
/**
+1 -5
View File
@@ -32,11 +32,7 @@ class productModel extends model
$product = $this->getByID($productID);
if($product)
{
$project = $this->loadModel('project')->getByID($product->program);
if(isset($project->id)) $this->loadModel('project')->setMenu($products, $project->id);
$this->lang->modulePageNav = $this->getModuleNav($products, $project, $product, $extra, $branch, $module, $moduleType);
$this->lang->modulePageNav = $this->getModuleNav($products, '', $product, $extra, $branch, $module, $moduleType);
}
$pageActions = '';
+2 -2
View File
@@ -954,7 +954,7 @@ class projectModel extends model
/* In case of a waterfall model, obtain sub-stage data. */
$PRJData = $this->getById($this->session->PRJ);
if($PRJData->model == 'waterfall')
if($PRJData and $PRJData->model == 'waterfall')
{
$childrens = $this->dao->select('*')->from(TABLE_PROJECT)
->where('parent')->in(array_keys($projects))
@@ -1059,7 +1059,7 @@ class projectModel extends model
}
/* In the case of the waterfall model, calculate the sub-stage. */
if($PRJData->model == 'waterfall')
if($PRJData and $PRJData->model == 'waterfall')
{
foreach($parents as $id => $project) $project->children = isset($children[$id]) ? $children[$id] : array();
}
+3 -8
View File
@@ -189,7 +189,6 @@ class storyModel extends model
->add('assignedDate', 0)
->add('version', 1)
->add('status', 'draft')
->setDefault('program', $this->session->PRJ)
->setDefault('plan,verify', '')
->setDefault('openedBy', $this->app->user->account)
->setDefault('openedDate', $now)
@@ -383,7 +382,6 @@ class storyModel extends model
$story->keywords = $stories->keywords[$i];
$story->sourceNote = $stories->sourceNote[$i];
$story->product = $productID;
$story->program = $this->session->PRJ;
$story->openedBy = $this->app->user->account;
$story->openedDate = $now;
$story->version = 1;
@@ -2119,7 +2117,7 @@ class storyModel extends model
}
else
{
$products = $this->loadModel('product')->getPairs('', $this->session->PRJ);
$products = $this->loadModel('product')->getPairs();
}
$query = $queryID ? $this->loadModel('search')->getQuery($queryID) : '';
@@ -2419,13 +2417,12 @@ class storyModel extends model
* @access public
* @return array
*/
public function getUserStories($account, $type = 'assignedTo', $orderBy = 'id_desc', $pager = null, $storyType = 'story', $programID = 0)
public function getUserStories($account, $type = 'assignedTo', $orderBy = 'id_desc', $pager = null, $storyType = 'story')
{
$stories = $this->dao->select('t1.*, t2.name as productTitle')->from(TABLE_STORY)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
->where('t1.deleted')->eq(0)
->andWhere('t1.type')->eq($storyType)
->beginIF($programID)->andWhere('t1.PRJ')->eq($programID)->fi()
->beginIF($type != 'closedBy' and $this->app->moduleName == 'block')->andWhere('t1.status')->ne('closed')->fi()
->beginIF($type != 'all')
->beginIF($type == 'assignedTo')->andWhere('assignedTo')->eq($account)->fi()
@@ -2734,7 +2731,7 @@ class storyModel extends model
->where($this->reportCondition())
->groupBy('product')->orderBy('value DESC')->fetchAll('name');
if(!$datas) return array();
$products = $this->loadModel('product')->getPairs('', $this->session->PRJ);
$products = $this->loadModel('product')->getPairs();
foreach($datas as $productID => $data) $data->name = isset($products[$productID]) ? $products[$productID] : $this->lang->report->undefined;
return $datas;
}
@@ -3633,8 +3630,6 @@ class storyModel extends model
{
$requirement = $this->getByID($id);
$data = new stdclass();
$data->program = $this->session->PRJ;
$data->product = $this->session->product;
$data->AType = 'requirement';
$data->BType = 'story';
$data->relation = 'subdivideinto';
+2 -2
View File
@@ -133,7 +133,7 @@ class testcaseModel extends model
->add('status', $status)
->add('version', 1)
->add('fromBug', $bugID)
->add('program', $this->session->PRJ)
->add('PRJ', $this->session->PRJ)
->setDefault('openedBy', $this->app->user->account)
->setDefault('openedDate', $now)
->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion((int)$this->post->story))
@@ -227,7 +227,7 @@ class testcaseModel extends model
$data[$i] = new stdclass();
$data[$i]->product = $productID;
$data[$i]->program = $this->session->PRJ;
$data[$i]->PRJ = $this->session->PRJ;
$data[$i]->branch = $cases->branch[$i];
$data[$i]->module = $cases->module[$i];
$data[$i]->type = $cases->type[$i];
+1 -1
View File
@@ -305,7 +305,7 @@ class upgrade extends control
$productlines = $this->dao->select('*')->from(TABLE_MODULE)->where('type')->eq('line')->orderBy('id_desc')->fetchAll('id');
$noMergedProducts = $this->dao->select('*')->from(TABLE_PRODUCT)->where('line')->in(array_keys($productlines))->orderBy('id_desc')->fetchAll('id');
if(empty($productlines)) $this->locate($this->createLink('upgrade', 'mergeProgram', 'type=product'));
if(empty($productlines) || empty($noMergedProducts)) $this->locate($this->createLink('upgrade', 'mergeProgram', 'type=product'));
$noMergedSprints = $this->dao->select('t1.*')->from(TABLE_PROJECT)->alias('t1')
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id=t2.project')
+10
View File
@@ -4003,6 +4003,16 @@ class upgradeModel extends model
*/
public function processMergedData($programID, $projectID, $productIdList = array(), $sprintIdList = array())
{
/* Product linked objects. */
$this->dao->update(TABLE_STORY)->set('PRJ')->eq($programID)->where('product')->in($productIdList)->exec();
$this->dao->update(TABLE_RELEASE)->set('PRJ')->eq($programID)->where('product')->in($productIdList)->exec();
$this->dao->update(TABLE_BUG)->set('PRJ')->eq($projectID)->where('product')->in($productIdList)->exec();
$this->dao->update(TABLE_CASE)->set('PRJ')->eq($projectID)->where('product')->in($productIdList)->exec();
$this->dao->update(TABLE_TESTREPORT)->set('PRJ')->eq($projectID)->where('product')->in($productIdList)->exec();
$this->dao->update(TABLE_TESTSUITE)->set('PRJ')->eq($projectID)->where('product')->in($productIdList)->exec();
$this->dao->update(TABLE_BUILD)->set('PRJ')->eq($projectID)->where('product')->in($productIdList)->exec();
$this->dao->update(TABLE_DOC)->set('PRJ')->eq($projectID)->where("lib IN(SELECT id from " . TABLE_DOCLIB . " WHERE type = 'product' and product " . helper::dbIN($productIdList) . ')')->exec();
/* Project linked objects. */
$this->dao->update(TABLE_TASK)->set('PRJ')->eq($projectID)->where('project')->in($sprintIdList)->exec();
$this->dao->update(TABLE_DOC)->set('PRJ')->eq($projectID)->where("lib IN(SELECT id from " . TABLE_DOCLIB . " WHERE type = 'project' and project " . helper::dbIN($sprintIdList) . ')')->exec();