diff --git a/module/common/model.php b/module/common/model.php index ab36bf5882..27e2443cc6 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -918,6 +918,9 @@ class commonModel extends model public static function getMainNavList($moduleName) { global $lang; + global $app; + + $app->loadLang('my'); $menuOrder = $lang->mainNav->menuOrder; ksort($menuOrder); @@ -963,8 +966,24 @@ class commonModel extends model } } + /* Check whether other preference item under the module have permissions. If yes, point to other methods. */ + $moduleLinkList = $currentModule . 'LinkList'; + if(!$display and isset($lang->my->$moduleLinkList)) + { + foreach($lang->my->$moduleLinkList as $key => $linkList) + { + $method = explode('-', $key)[1]; + if(common::hasPriv($currentModule, $method)) + { + $display = true; + $currentMethod = $method; + break; + } + } + } + /* Check whether other methods under the module have permissions. If yes, point to other methods. */ - if($display == false and isset($lang->$currentModule->menu)) + if($display == false and isset($lang->$currentModule->menu) and !in_array($currentModule, array('program', 'product', 'project', 'execution'))) { foreach($lang->$currentModule->menu as $menu) { diff --git a/module/execution/model.php b/module/execution/model.php index 108f02118b..3df5779489 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -369,12 +369,12 @@ class executionModel extends model $this->lang->project->code = $this->lang->execution->execCode; } - $sprintProject = isset($sprint->project) ? $sprint->project : ''; + $sprintProject = isset($sprint->project) ? $sprint->project : '0'; $this->dao->insert(TABLE_EXECUTION)->data($sprint) ->autoCheck($skipFields = 'begin,end') ->batchcheck($this->config->execution->create->requiredFields, 'notempty') ->checkIF((!empty($sprint->name) and $this->config->systemMode == 'new'), 'name', 'unique', "`type` in ('sprint','stage', 'kanban') and `project` = $sprintProject") - ->checkIF(!empty($sprint->code), 'code', 'unique', "`type` in ('sprint','stage')") + ->checkIF(!empty($sprint->code), 'code', 'unique', "`type` in ('sprint','stage', 'kanban')") ->checkIF($sprint->begin != '', 'begin', 'date') ->checkIF($sprint->end != '', 'end', 'date') ->checkIF($sprint->end != '', 'end', 'ge', $sprint->begin) @@ -511,18 +511,17 @@ class executionModel extends model } /* Update data. */ - $executionProject = isset($execution->project) ? $execution->project : ''; + $executionProject = isset($execution->project) ? $execution->project : '0'; $this->dao->update(TABLE_EXECUTION)->data($execution) ->autoCheck($skipFields = 'begin,end') ->batchcheck($this->config->execution->edit->requiredFields, 'notempty') ->checkIF($execution->begin != '', 'begin', 'date') ->checkIF($execution->end != '', 'end', 'date') ->checkIF($execution->end != '', 'end', 'ge', $execution->begin) - ->checkIF((!empty($execution->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $executionProject") - ->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')") + ->checkIF((!empty($execution->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $executionID and type in ('sprint','stage', 'kanban') and `project` = $executionProject") + ->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage', 'kanban')") ->checkFlow() ->where('id')->eq($executionID) - ->checkFlow() ->limit(1) ->exec();