Merge branch ztflow-wangyuting-dev/bug-62931#wangyuting of zentao/zentaopms (#9022)

This commit is contained in:
刘刚
2025-05-29 15:27:31 +08:00
committed by Gitfox
8 changed files with 32 additions and 10 deletions
+3
View File
@@ -1045,6 +1045,9 @@ class execution extends control
*/
public function create(int $projectID = 0, int $executionID = 0, int $copyExecutionID = 0, int $planID = 0, string $confirm = 'no', int $productID = 0, string $extra = '')
{
$project = empty($projectID) ? null : $this->loadModel('project')->fetchByID($projectID);
if(!empty($project->isTpl)) define('AUTOTPL', false);
if($this->app->tab == 'doc') unset($this->lang->doc->menu->execution['subMenu']);
if($this->app->tab == 'project') $this->project->setMenu($projectID);
+6 -6
View File
@@ -150,6 +150,7 @@ class executionModel extends model
/* 模板执行不显示1.5级导航。 */
$this->config->hasDropmenuApps = array_diff($this->config->hasDropmenuApps, array('project', 'execution'));
$this->lang->switcherMenu = '';
unset($this->lang->execution->menu->kanban);
unset($this->lang->execution->menu->burn);
@@ -239,9 +240,9 @@ class executionModel extends model
}
/* 项目模板不校验访问权限。 */
$isTpl = $this->dao->select('isTpl')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch('isTpl');
$isTpl = $this->dao->select('isTpl')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->andWhere('id')->in($this->app->user->view->sprints)->fetch('isTpl');
/* If the execution doesn't exist in the list, use the first execution in the list. */
if(!$isTpl && !isset($executions[$executionID]))
if(empty($isTpl) && !isset($executions[$executionID]))
{
/* Check execution. */
if($executionID)
@@ -1482,7 +1483,7 @@ class executionModel extends model
{
/* Construct the query SQL at search executions. */
$executionQuery = $browseType == 'bySearch' ? $this->getExecutionQuery($param) : '';
if($projectID) $project = $this->dao->select('model,isTpl')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch();
$projectModel = $this->dao->select('model')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch('model');
return $this->dao->select('t1.*,t2.name projectName, t2.model as projectModel')->from(TABLE_EXECUTION)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
@@ -1491,9 +1492,8 @@ class executionModel extends model
->andWhere('t1.deleted')->eq('0')
->andWhere('t1.vision')->eq($this->config->vision)
->andWhere('t1.multiple')->eq('1')
->beginIF(!empty($project->isTpl))->andWhere('t1.isTpl')->eq('1')->fi()
->beginIF(!empty($project->model) && $project->model == 'ipd')->andWhere('t1.enabled')->eq('on')->fi()
->beginIF(!$this->app->user->admin && empty($project->isTpl))->andWhere('t1.id')->in($this->app->user->view->sprints)->fi()
->beginIF($projectModel == 'ipd')->andWhere('t1.enabled')->eq('on')->fi()
->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->sprints)->fi()
->beginIF(!empty($executionQuery))->andWhere($executionQuery)->fi()
->beginIF($productID)->andWhere('t3.product')->eq($productID)->fi()
->beginIF($projectID)->andWhere('t1.project')->eq($projectID)->fi()
+8 -1
View File
@@ -12,13 +12,20 @@ title=测试 executionModel::checkAccess;
timeout=0
cid=1
- 不传入ID @101
- 传入存在ID的值 @106
- 不传入ID,读取session信息 @101
- 传入不存在的ID @101
- 传入不存在的ID @101
*/
$executions = array(101 => 101, 102 => 102, 106 => 106);
$idList = array(0, 106, 110);
$idList = array(0, 106, 110, 120);
$executionTester = new executionTest();
r($executionTester->checkAccessTest($idList[0], $executions)) && p() && e('101'); //不传入ID
r($executionTester->checkAccessTest($idList[1], $executions)) && p() && e('106'); //传入存在ID的值
r($executionTester->checkAccessTest($idList[0], $executions)) && p() && e('101'); //不传入ID,读取session信息
r($executionTester->checkAccessTest($idList[2], $executions)) && p() && e('101'); //传入不存在的ID
r($executionTester->checkAccessTest($idList[3], $executions)) && p() && e('101'); //传入不存在的ID
+3
View File
@@ -950,6 +950,7 @@ class executionZen extends execution
->setDefault('type', $type)
->setDefault('team', $this->post->name)
->setDefault('parent', $this->post->project)
->setDefault('isTpl', $project->isTpl)
->setIF($this->post->parent, 'parent', $this->post->parent)
->setIF($this->post->heightType == 'auto', 'displayCards', 0)
->setIF($this->post->acl == 'open', 'whitelist', '')
@@ -2278,6 +2279,8 @@ class executionZen extends execution
if($this->app->tab == 'project') return $this->config->vision != 'lite' ? $this->createLink('project', 'index', "projectID=$projectID") : $this->createLink('project', 'execution', "status=all&projectID=$projectID");
return inlink('kanban', "executionID=$executionID");
}
$execution = $this->execution->fetchByID($executionID);
if(!empty($execution->isTpl)) return inlink('task', "executionID=$executionID");
return inlink('create', "projectID=$projectID&executionID=$executionID");
}
+1
View File
@@ -86,6 +86,7 @@ class programplanZen extends programplan
$plan->order = (int)array_shift($orders);
$plan->hasProduct = $project->hasProduct;
$plan->parent = $parentID ? $parentID : $projectID;
$plan->isTpl = $project->isTpl;
if($plan->id && isset($oldPlans[$plan->id])) $plan->parent = $oldPlans[$plan->id]->parent;
if(!empty($plan->percent) && $plan->type != 'stage') $plan->percent = 0; // 非阶段类型,工作量占比为0
+2 -2
View File
@@ -218,8 +218,8 @@ class projectModel extends model
}
/* 项目模板不校验访问权限。 */
$isTpl = $this->dao->select('isTpl')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch('isTpl');
if(!$isTpl && !isset($projects[$projectID]))
$isTpl = $this->dao->select('isTpl')->from(TABLE_PROJECT)->where('id')->eq($projectID)->andWhere('id')->in($this->app->user->view->projects)->fetch('isTpl');
if(empty($isTpl) && !isset($projects[$projectID]))
{
if($projectID && strpos(",{$this->app->user->view->projects},", ",{$projectID},") === false && !empty($projects))
{
+8 -1
View File
@@ -11,14 +11,21 @@ title=测试 programModel::checkAccess;
timeout=0
cid=1
- 不传入ID @10
- 传入存在ID的值 @11
- 不传入ID,读取session信息 @11
- 传入正确的ID @14
- 传入不存在的ID @0
*/
global $tester;
$tester->loadModel('project');
$projects = array(10 => 10, 11 => 11, 14 => 14);
$idList = array(0, 11, 14);
$idList = array(0, 11, 14, 16);
r($tester->project->checkAccess($idList[0], $projects)) && p() && e('10'); //不传入ID
r($tester->project->checkAccess($idList[1], $projects)) && p() && e('11'); //传入存在ID的值
r($tester->project->checkAccess($idList[0], $projects)) && p() && e('11'); //不传入ID,读取session信息
r($tester->project->checkAccess($idList[2], $projects)) && p() && e('14'); //传入正确的ID
r($tester->project->checkAccess($idList[3], $projects)) && p() && e('0'); //传入不存在的ID
+1
View File
@@ -699,6 +699,7 @@ class taskZen extends task
$task = form::data($formConfig)->setDefault('execution', $executionID)
->setDefault('project', $execution->project)
->setDefault('left', 0)
->setDefault('isTpl', $execution->isTpl)
->setIF($this->post->estimate, 'left', $this->post->estimate)
->setIF($this->post->mode, 'mode', $this->post->mode)
->setIF($this->post->story, 'storyVersion', $this->post->story ? $this->loadModel('story')->getVersion((int)$this->post->story) : 1)