From acc7774419277cc6eef8998724318a2733448fcb Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 30 Sep 2022 13:22:24 +0800 Subject: [PATCH] * adjust for manage members and products for no multiple project. --- module/execution/model.php | 12 ++++++++++++ module/project/control.php | 19 ++++++++++++++++--- module/project/model.php | 2 +- module/project/view/manageproducts.html.php | 1 + 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 1d86ef375d..54e0572058 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1673,6 +1673,18 @@ class executionModel extends model return $executions; } + /** + * Get no multiple execution id. + * + * @param int $projectID + * @access public + * @return int + */ + public function getNoMultipleID($projectID) + { + return $this->dao->select('id')->from(TABLE_EXECUTION)->where('project')->eq($projectID)->andWhere('multiple')->eq(0)->andWhere('deleted')->eq(0)->fetch('id'); + } + /** * Create the link from module,method,extra * diff --git a/module/project/control.php b/module/project/control.php index e04888dff3..45c906b1df 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1645,19 +1645,25 @@ class project extends control $this->loadModel('dept'); $this->loadModel('execution'); $this->project->setMenu($projectID); + $project = $this->project->getById($projectID); if(!empty($_POST)) { $this->project->manageMembers($projectID); if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); + if(empty($project->multiple)) + { + $executionID = $this->execution->getNoMultipleID($projectID); + if($executionID) $this->execution->manageMembers($executionID); + } + $this->loadModel('action')->create('team', $projectID, 'ManagedTeam'); $link = $this->session->teamList ? $this->session->teamList : $this->createLink('project', 'team', "projectID=$projectID"); return $this->send(array('message' => $this->lang->saveSuccess, 'result' => 'success', 'locate' => $link)); } - $project = $this->project->getById($projectID); $users = $this->user->getPairs('noclosed|nodeleted|devfirst'); $roles = $this->user->getUserRoles(array_keys($users)); $deptUsers = $dept === '' ? array() : $this->dept->getDeptUserPairs($dept); @@ -2113,6 +2119,8 @@ class project extends control { $this->loadModel('product'); $this->loadModel('program'); + $this->loadModel('execution'); + $project = $this->project->getById($projectID); if(!empty($_POST)) { @@ -2126,6 +2134,12 @@ class project extends control $this->project->updateProducts($projectID); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + if(empty($project->multiple)) + { + $executionID = $this->execution->getNoMultipleID($projectID); + if($executionID) $this->execution->updateProducts($executionID); + } + $oldProducts = array_keys($oldProducts); $newProducts = $this->product->getProducts($projectID); $newProducts = array_keys($newProducts); @@ -2137,7 +2151,6 @@ class project extends control return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locateLink)); } - $project = $this->project->getById($projectID); if($this->app->tab == 'program') { $this->program->setMenu($project->parent); @@ -2177,7 +2190,7 @@ class project extends control /* Assign. */ $this->view->title = $this->lang->project->manageProducts . $this->lang->colon . $project->name; - $this->view->position[] = $this->lang->project->manageProducts; + $this->view->project = $project; $this->view->allProducts = $allProducts; $this->view->linkedProducts = $linkedProducts; $this->view->linkedBranches = $linkedBranches; diff --git a/module/project/model.php b/module/project/model.php index 88bc98e5bd..4ab514ac66 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -2031,7 +2031,7 @@ class projectModel extends model if(!empty($linkedProducts)) $this->user->updateUserView(array_keys($linkedProducts), 'product', $changedAccounts); /* Remove execution members. */ - if($removeExecution == 'yes' and !empty($childSprints) and !empty($removedAccounts)) + if($this->post->removeExecution == 'yes' and !empty($childSprints) and !empty($removedAccounts)) { $this->dao->delete()->from(TABLE_TEAM) ->where('root')->in($childSprints) diff --git a/module/project/view/manageproducts.html.php b/module/project/view/manageproducts.html.php index 1a214f23ff..e894e83887 100644 --- a/module/project/view/manageproducts.html.php +++ b/module/project/view/manageproducts.html.php @@ -29,6 +29,7 @@ + multiple)) $isDisabled = '';?> project->notAllowRemoveProducts : $productName;?>