diff --git a/config/zentaopms.php b/config/zentaopms.php index 2d3fe90dfa..40ec64cfce 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -417,7 +417,7 @@ $config->pipelineTypeList = array('gitlab', 'gogs', 'gitea', 'jenkins', 'sonarqu $config->programPriv = new stdclass(); $config->programPriv->noSprint = array('task', 'story', 'tree', 'project', 'execution', 'build', 'bug', 'testcase', 'testreport', 'doc', 'repo', 'stakeholder', 'projectrelease', 'requirement'); $config->programPriv->scrum = array('story', 'requirement', 'productplan', 'tree', 'projectplan', 'projectstory', 'projectrelease', 'project', 'execution', 'build', 'bug', 'testcase', 'testreport', 'doc', 'repo', 'meeting', 'stakeholder', 'testtask'); -$config->programPriv->waterfall = array_merge($config->programPriv->scrum, array('task', 'workestimation', 'durationestimation', 'budget', 'programplan', 'review', 'reviewissue', 'weekly', 'cm', 'milestone', 'design', 'issue', 'risk', 'opportunity', 'measrecord', 'auditplan', 'trainplan', 'gapanalysis', 'pssp', 'researchplan', 'researchreport')); +$config->programPriv->waterfall = array_merge($config->programPriv->scrum, array('workestimation', 'durationestimation', 'budget', 'programplan', 'review', 'reviewissue', 'weekly', 'cm', 'milestone', 'design', 'issue', 'risk', 'opportunity', 'measrecord', 'auditplan', 'trainplan', 'gapanalysis', 'pssp', 'researchplan', 'researchreport')); $config->waterfallModules = array('workestimation', 'durationestimation', 'budget', 'programplan', 'review', 'reviewissue', 'weekly', 'cm', 'milestone', 'design', 'opportunity', 'auditplan', 'trainplan', 'gapanalysis', 'pssp', 'researchplan', 'researchreport'); diff --git a/module/bug/control.php b/module/bug/control.php index eb6b86c45f..b0651b9bb2 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1822,11 +1822,6 @@ class bug extends control if(!isset($users[$assignedTo])) $assignedTo = $this->bug->getModuleOwner($bug->module, $productID); unset($this->lang->bug->resolutionList['tostory']); - $product = $this->loadModel('product')->getById($productID); - $branch = $product->type == 'branch' ? ($bug->branch > 0 ? $bug->branch . ',0' : '0') : ''; - $productBugs = $this->bug->getProductBugPairs($productID, $branch); - unset($productBugs[$bugID]); - $this->bug->checkBugExecutionPriv($bug); $this->qa->setMenu($this->products, $productID, $bug->branch); @@ -1834,7 +1829,6 @@ class bug extends control $this->view->bug = $bug; $this->view->users = $users; $this->view->assignedTo = $assignedTo; - $this->view->productBugs = $productBugs; $this->view->executions = $this->loadModel('product')->getExecutionPairsByProduct($productID, $bug->branch ? "0,{$bug->branch}" : 0, 'id_desc', $projectID, 'stagefilter'); $this->view->builds = $this->loadModel('build')->getBuildPairs($productID, $bug->branch, 'withbranch,noreleased'); $this->view->actions = $this->action->getList('bug', $bugID); @@ -2476,6 +2470,24 @@ class bug extends control return print(html::select('assignedTo', $productMembers, $selectedUser, 'class="form-control"')); } + /** + * Ajax get product bugs. + * + * @param int $productID + * @param int $bugID + * @access public + * @return string + */ + public function ajaxGetProductBugs($productID, $bugID) + { + $product = $this->loadModel('product')->getById($productID); + $branch = $product->type == 'branch' ? ($bug->branch > 0 ? $bug->branch . ',0' : '0') : ''; + $productBugs = $this->bug->getProductBugPairs($productID, $branch); + unset($productBugs[$bugID]); + + return print(html::select('duplicateBug', $productBugs, '', "class='form-control' placeholder='{$this->lang->bug->duplicateTip}'")); + } + /** * Ajax get project team members. * diff --git a/module/bug/js/common.js b/module/bug/js/common.js index 81920153b2..59fee7d102 100644 --- a/module/bug/js/common.js +++ b/module/bug/js/common.js @@ -298,7 +298,7 @@ function loadProductModules(productID) if(typeof(branch) == 'undefined') branch = 0; if(typeof(moduleID) == 'undefined') moduleID = 0; if(config.currentMethod == 'edit') moduleID = $('#module').val(); - link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=¤tModuleID=' + moduleID); + link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=nodeleted¤tModuleID=' + moduleID); $('#moduleIdBox').load(link, function() { $(this).find('select').chosen() diff --git a/module/bug/js/resolve.js b/module/bug/js/resolve.js index 8afea5743c..2dc1d67371 100644 --- a/module/bug/js/resolve.js +++ b/module/bug/js/resolve.js @@ -2,6 +2,18 @@ function setDuplicate(resolution) { if(resolution == 'duplicate') { + $.ajaxSettings.async = false; + $.get(createLink('bug', 'ajaxGetProductBugs', 'projectID=' + productID + '&bugID=' + bugID),function(data) + { + $('#duplicateBug').replaceWith(data); + $('#pk_duplicateBug-search').parent().parent().remove(); + $('#duplicateBug').picker( + { + disableEmptySearch : true, + dropWidth : 'auto' + }); + }); + $.ajaxSettings.async = true; $('#duplicateBugBox').show(); } else diff --git a/module/bug/model.php b/module/bug/model.php index b1bc91512f..e66901ea90 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1023,6 +1023,7 @@ class bugModel extends model ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', $now) ->setDefault('assignedDate', $now) + ->setDefault('mailto', '') ->stripTags($this->config->bug->editor->assignto['id'], $this->config->allowedTags) ->remove('comment,showModule') ->join('mailto', ',') @@ -1060,6 +1061,7 @@ class bugModel extends model ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', $now) ->setDefault('assignedDate', $now) + ->setDefault('mailto', '') ->stripTags($this->config->bug->editor->confirmbug['id'], $this->config->allowedTags) ->remove('comment') ->join('mailto', ',') diff --git a/module/bug/view/resolve.html.php b/module/bug/view/resolve.html.php index 78ed516c22..b7b04261b1 100644 --- a/module/bug/view/resolve.html.php +++ b/module/bug/view/resolve.html.php @@ -16,6 +16,7 @@ product); +js::set('bugID', $bug->id); js::set('released', $lang->build->released); ?>
@@ -39,7 +40,7 @@ js::set('released', $lang->build->released); bug->duplicateBug;?> - bug->duplicateTip}'");?> + bug->duplicateTip}'");?> bug->resolvedBuild;?> diff --git a/module/common/view/successmodal.html.php b/module/common/view/successmodal.html.php deleted file mode 100644 index 4933fc4dfa..0000000000 --- a/module/common/view/successmodal.html.php +++ /dev/null @@ -1,33 +0,0 @@ - - - diff --git a/module/execution/control.php b/module/execution/control.php index f08c6ed378..92a51ab52a 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -282,7 +282,7 @@ class execution extends control /* Get tasks and group them. */ if(empty($groupBy))$groupBy = 'story'; - if(($groupBy == 'story') and ($execution->type == 'ops'))$groupBy = 'status'; + if(($groupBy == 'story') and ($execution->lifetime == 'ops')) $groupBy = 'status'; $sort = common::appendOrder($groupBy); $tasks = $this->loadModel('task')->getExecutionTasks($executionID, $productID = 0, $status = 'all', $modules = 0, $sort); $groupBy = str_replace('`', '', $groupBy); @@ -2657,6 +2657,7 @@ class execution extends control unset($this->lang->kanban->type['story']); unset($this->lang->kanban->type['bug']); unset($this->lang->kanban->type['all']); + unset($this->lang->kanban->group->task['story']); } if($groupBy == 'story' and $browseType == 'task' and !isset($this->lang->kanban->orderList[$orderBy])) $orderBy = 'id_asc'; diff --git a/module/execution/js/task.js b/module/execution/js/task.js index ec899288f9..8a8d1f948f 100644 --- a/module/execution/js/task.js +++ b/module/execution/js/task.js @@ -41,3 +41,29 @@ function adjustTableFooter() $('.table-footer').css({'left': 0, 'bottom': 0, 'width': 'unset'}); } } + +/** + * Ajax refresh. + * + * @access public + * @return void + */ +function ajaxRefresh() +{ + var $table = $('#executionTaskForm').closest('[data-ride="table"]'); + if($table.length) + { + var table = $table.data('zui.table'); + if(table) + { + table.options.replaceId = 'executionTaskForm'; + table.reload(); + } + } + $.get(location.href, function(data) + { + var $data = $(data); + $('#mainMenu > div.btn-toolbar.pull-left').html($data.find('#mainMenu > div.btn-toolbar.pull-left').html()); + if($data.find('#mainContent .main-col .table-empty-tip').length) $('#mainContent .main-col').html($data.find('#mainContent .main-col')); + }); +} diff --git a/module/execution/view/grouptask.html.php b/module/execution/view/grouptask.html.php index 87dc3aa96f..6a976a3da3 100644 --- a/module/execution/view/grouptask.html.php +++ b/module/execution/view/grouptask.html.php @@ -103,7 +103,7 @@ execution->groups as $key => $value):?> type == 'ops' && $key == 'story') continue; + if($execution->lifetime == 'ops' && $key == 'story') continue; $active = $key == $groupBy ? "class='active'" : ''; echo "
  • "; common::printLink('execution', 'groupTask', "execution=$executionID&groupBy=$key", $value); echo '
  • '; ?> diff --git a/module/execution/view/task.html.php b/module/execution/view/task.html.php index bf70233621..36056b17a2 100644 --- a/module/execution/view/task.html.php +++ b/module/execution/view/task.html.php @@ -62,7 +62,7 @@ body {margin-bottom: 25px;} common::sortFeatureMenu(); foreach(customModel::getFeatureMenu('execution', 'task') as $menuItem) { - if($execution->type == 'ops' && $menuItem->name == 'needconfirm') continue; + if($execution->lifetime == 'ops' && $menuItem->name == 'needconfirm') continue; if(isset($menuItem->hidden)) continue; $menuType = $menuItem->name; if($menuType == 'QUERY') @@ -215,7 +215,7 @@ body {margin-bottom: 25px;} if($useDatatable) include '../../common/view/datatable.html.php'; $customFields = $this->datatable->getSetting('execution'); - if($execution->type == 'ops') + if($execution->lifetime == 'ops') { foreach($customFields as $id => $customField) { diff --git a/module/execution/view/taskheader.html.php b/module/execution/view/taskheader.html.php index e7c2eea834..78dc5503ef 100644 --- a/module/execution/view/taskheader.html.php +++ b/module/execution/view/taskheader.html.php @@ -28,7 +28,7 @@ foreach(customModel::getFeatureMenu('execution', 'task') as $menuItem) { - if($execution->type == 'ops' && $menuItem->name == 'needconfirm') continue; + if($execution->lifetime == 'ops' && $menuItem->name == 'needconfirm') continue; if(isset($menuItem->hidden)) continue; $menuType = $menuItem->name; if(strpos($menuType, 'QUERY') === 0) @@ -74,7 +74,7 @@ foreach ($lang->execution->groups as $key => $value) { if($key == '') continue; - if($execution->type == 'ops' && $key == 'story') continue; + if($execution->lifetime == 'ops' && $key == 'story') continue; echo ''; common::printLink('execution', 'groupTask', "execution=$executionID&groupBy=$key", $value); } diff --git a/module/execution/view/treetask.html.php b/module/execution/view/treetask.html.php index 287204f2ee..0d8a9b57c4 100644 --- a/module/execution/view/treetask.html.php +++ b/module/execution/view/treetask.html.php @@ -45,7 +45,7 @@ desc) ? $task->desc : "
    " . $lang->noData . '
    ';?>
    -type != 'ops'):?> +lifetime != 'ops'):?> fromBug != 0):?>
    bug->steps;?>
    diff --git a/module/kanban/control.php b/module/kanban/control.php index 1070aef18e..ad818eafd1 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -1197,6 +1197,7 @@ class kanban extends control $pager = new pager($recTotal, $recPerPage, $pageID); $productPairs = $this->product->getPairs('', 0, '', 'all'); + $productPairs = array($this->lang->kanban->allProducts) + $productPairs; $selectedProductID = empty($selectedProductID) ? key($productPairs) : $selectedProductID; /* Waterfall project has no plan. */ diff --git a/module/message/model.php b/module/message/model.php index f0191d4173..d9a2a8c564 100755 --- a/module/message/model.php +++ b/module/message/model.php @@ -144,7 +144,7 @@ class messageModel extends model $table = $this->config->objectTables[$objectType]; $field = $this->config->action->objectNameFields[$objectType]; $object = $this->dao->select('*')->from($table)->where('id')->eq($objectID)->fetch(); - $toList = $this->getToList($object, $objectType); + $toList = $this->getToList($object, $objectType, $actionID); if(empty($toList)) return false; if($toList == $actor) return false; @@ -181,10 +181,11 @@ class messageModel extends model * * @param object $object * @param string $objectType + * @param int $actionID * @access public * @return string */ - public function getToList($object, $objectType) + public function getToList($object, $objectType, $actionID = 0) { $toList = ''; if(!empty($object->assignedTo)) $toList = $object->assignedTo; @@ -211,6 +212,13 @@ class messageModel extends model if($toList == 'closed') $toList = ''; if($objectType == 'feedback' and $object->status == 'replied') $toList = ',' . $object->openedBy . ','; + if($objectType == 'story' and $actionID) + { + $action = $this->loadModel('action')->getById($actionID); + list($toList, $ccList) = $this->loadModel($objectType)->getToAndCcList($object, $action->action); + $toList = $toList . $ccList; + } + return $toList; } diff --git a/module/misc/control.php b/module/misc/control.php index b7fb0fe17b..a8ceb47dd6 100644 --- a/module/misc/control.php +++ b/module/misc/control.php @@ -230,6 +230,7 @@ class misc extends control */ public function captcha($sessionVar = 'captcha', $uuid = '') { + if($sessionVar == 'user') die('The string user is not allowed to be defined as a session field.'); $obLevel = ob_get_level(); for($i = 0; $i < $obLevel; $i++) ob_end_clean(); diff --git a/module/my/control.php b/module/my/control.php index 75e03d3233..09fbf922f7 100755 --- a/module/my/control.php +++ b/module/my/control.php @@ -1154,18 +1154,20 @@ EOF; $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'workFeedback'); - $storyIdList = $bugIdList = $todoIdList = $taskIdList = array(); + $storyIdList = $bugIdList = $todoIdList = $taskIdList = $ticketIdList = array(); foreach($feedbacks as $feedback) { - if($feedback->solution == 'tobug') $bugIdList[] = $feedback->result; - if($feedback->solution == 'tostory') $storyIdList[] = $feedback->result; - if($feedback->solution == 'totodo') $todoIdList[] = $feedback->result; - if($feedback->solution == 'totask') $taskIdList[] = $feedback->result; + if($feedback->solution == 'tobug') $bugIdList[] = $feedback->result; + if($feedback->solution == 'tostory') $storyIdList[] = $feedback->result; + if($feedback->solution == 'totodo') $todoIdList[] = $feedback->result; + if($feedback->solution == 'totask') $taskIdList[] = $feedback->result; + if($feedback->solution == 'ticket') $ticketIdList[] = $feedback->result; } - $bugs = $bugIdList ? $this->loadModel('bug')->getByList($bugIdList) : array(); - $stories = $storyIdList ? $this->loadModel('story')->getByList($storyIdList) : array(); - $todos = $todoIdList ? $this->loadModel('todo')->getByList($todoIdList) : array(); - $tasks = $taskIdList ? $this->loadModel('task')->getByList($taskIdList) : array(); + $bugs = $bugIdList ? $this->loadModel('bug')->getByList($bugIdList) : array(); + $stories = $storyIdList ? $this->loadModel('story')->getByList($storyIdList) : array(); + $todos = $todoIdList ? $this->loadModel('todo')->getByList($todoIdList) : array(); + $tasks = $taskIdList ? $this->loadModel('task')->getByList($taskIdList) : array(); + $tickets = $ticketIdList ? $this->loadModel('ticket')->getByList($ticketIdList) : array(); $products = $this->loadModel('product')->getPairs(); @@ -1199,9 +1201,10 @@ EOF; $this->view->todos = $todos; $this->view->stories = $stories; $this->view->tasks = $tasks; + $this->view->tickets = $tickets; $this->view->depts = $this->loadModel('dept')->getOptionMenu(); $this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted|noclosed'); - $this->view->projects = $this->loadModel('project')->getPairsByProgram(0, 'noclosed'); + $this->view->projects = $this->loadModel('project')->getPairsByProgram('', 'noclosed'); $this->view->allProducts = $this->dao->select('*')->from(TABLE_PRODUCT)->where('deleted')->eq('0')->fetchPairs('id', 'name'); $this->view->modulePairs = $this->tree->getModulePairs(0, 'feedback'); $this->view->modules = $this->tree->getOptionMenu(0, $viewType = 'feedback', 0); diff --git a/module/programplan/model.php b/module/programplan/model.php index 04fd203d96..cc18f4a942 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -54,14 +54,14 @@ class programplanModel extends model { if(empty($executionID)) return array(); - $plans = $this->dao->select('t2.*')->from(TABLE_PROJECTPRODUCT)->alias('t1') - ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') - ->where('t2.type')->eq('stage') - ->beginIF($productID)->andWhere('t1.product')->eq($productID)->fi() - ->beginIF($browseType == 'all')->andWhere('t2.project')->eq($executionID)->fi() - ->beginIF($browseType == 'parent')->andWhere('t2.parent')->eq($executionID)->fi() - ->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->sprints)->fi() - ->andWhere('t2.deleted')->eq('0') + $plans = $this->dao->select('t1.*')->from(TABLE_EXECUTION)->alias('t1') + ->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id = t2.project') + ->where('t1.type')->eq('stage') + ->beginIF($productID)->andWhere('t2.product')->eq($productID)->fi() + ->beginIF($browseType == 'all')->andWhere('t1.project')->eq($executionID)->fi() + ->beginIF($browseType == 'parent')->andWhere('t1.parent')->eq($executionID)->fi() + ->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->sprints)->fi() + ->andWhere('t1.deleted')->eq('0') ->orderBy($orderBy) ->fetchAll('id'); diff --git a/module/project/model.php b/module/project/model.php index ff9799ec50..2d5fedce17 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -827,7 +827,8 @@ class projectModel extends model ->where('type')->eq('project') ->andWhere('deleted')->eq(0) ->andWhere('vision')->eq($this->config->vision) - ->beginIF($programID !== '')->andWhere('path')->like("%,$programID,%")->fi() + ->beginIF(!empty($programID))->andWhere('path')->like("%,$programID,%")->fi() + ->beginIF($programID === 0)->andWhere('parent')->eq(0)->fi() ->beginIF($status != 'all' and $status != 'noclosed')->andWhere('status')->eq($status)->fi() ->beginIF($excludedModel)->andWhere('model')->ne($excludedModel)->fi() ->beginIF($model)->andWhere('model')->eq($model)->fi() diff --git a/module/repo/control.php b/module/repo/control.php index 327adc59aa..7b2ee1892e 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -1381,9 +1381,29 @@ class repo extends control { $content = file($logFile); $lastLine = $content[count($content) - 1]; + if(!strpos($lastLine, 'done')) { - return print(1); + if(strpos($lastLine, 'empty repository') !== false) + { + @unlink($logFile); + } + elseif(strpos($lastLine, 'Total') !== false) + { + $logContent = file_get_contents($logFile); + if(strpos($logContent, 'Counting objects: 100%') !== false and strpos($logContent, 'Compressing objects: 100%') !== false) + { + @unlink($logFile); + } + else + { + return print(1); + } + } + else + { + return print(1); + } } elseif(strpos($lastLine, 'fatal') !== false) { diff --git a/module/repo/model.php b/module/repo/model.php index 5ed4e397ef..29e3b8e167 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -332,9 +332,13 @@ class repoModel extends model if($type == 'bug') $links = $this->post->bugs; if($type == 'task') $links = $this->post->tasks; - $revisionID = $this->dao->select('id')->from(TABLE_REPOHISTORY)->where('repo')->eq($repoID)->andWhere('revision')->eq($revision)->fetch('id'); + $revisionInfo = $this->dao->select('*')->from(TABLE_REPOHISTORY)->where('repo')->eq($repoID)->andWhere('revision')->eq($revision)->fetch(); + $committer = $this->dao->select('account')->from(TABLE_USER)->where('commiter')->eq($revisionInfo->committer)->fetch('account'); + if(empty($committer)) $committer = $revisionInfo->committer; foreach($links as $linkID) { + $revisionID = $revisionInfo->id; + $relation = new stdclass; $relation->AType = 'revision'; $relation->AID = $revisionID; @@ -344,9 +348,9 @@ class repoModel extends model $this->dao->replace(TABLE_RELATION)->data($relation)->exec(); - if($type == 'story') $this->action->create('story', $linkID, 'linked2revision', '', $revisionID); - if($type == 'bug') $this->action->create('bug', $linkID, 'linked2revision', '', $revisionID); - if($type == 'task') $this->action->create('task', $linkID, 'linked2revision', '', $revisionID); + if($type == 'story') $this->action->create('story', $linkID, 'linked2revision', '', $revisionID, $committer); + if($type == 'bug') $this->action->create('bug', $linkID, 'linked2revision', '', $revisionID, $committer); + if($type == 'task') $this->action->create('task', $linkID, 'linked2revision', '', $revisionID, $committer); } } diff --git a/module/repo/view/ajaxgeteditorcontent.html.php b/module/repo/view/ajaxgeteditorcontent.html.php index b99f92b8ec..feb143dfbe 100644 --- a/module/repo/view/ajaxgeteditorcontent.html.php +++ b/module/repo/view/ajaxgeteditorcontent.html.php @@ -47,7 +47,7 @@ js::import($jsRoot . 'monaco-editor/min/vs/loader.js');
    - + @@ -135,12 +134,10 @@ function getRelation(commit) } $('.table-empty-tip').hide(); - $('#unlink').show(); $('#related button').show(); } else { - $('#unlink').hide(); if(!canLinkStory && !canLinkBug && !canLinkTask) $('#related button').hide(); } @@ -157,6 +154,16 @@ function getRelation(commit) $('#related').show(); } + +$('#relationTabs').on('onLoad', function(event, tab) { + var objectInfo = tab.id.split('-'); + objectID = objectInfo[0]; + objectType = objectInfo[1]; + unlink = createLink('repo', 'unlink', 'repoID=' + repoID + '&commit=' + globalCommit + '&objectID=' + objectID + '&objectType=' + objectType); + $('#relationTabs ul li[data-id=' + tab.id + '] span.title').after(''); +}); + + /** * Set tab data. * @@ -331,7 +338,7 @@ $(function() parent.loadLinkPage(link); }); - $('#unlink a').on('click', function() + $('#relationTabs').on('click', '.unlinks',function() { var link = $(this).attr('data-link'); $.post(link, function(data) @@ -352,11 +359,6 @@ $(function() { $('#tab-nav-item-' + tab.id).attr('title', tab.title); - var objectInfo = tab.id.split('-'); - objectID = objectInfo[0]; - objectType = objectInfo[1]; - $('#unlink a').attr('data-link', createLink('repo', 'unlink', 'repoID=' + repoID + '&commit=' + globalCommit + '&objectID=' + objectID + '&objectType=' + objectType)); - var relatedHeight = codeHeight / 5 * 2 - $('#log').height() - 45; $('#relationTabs iframe').css('height', relatedHeight); }); diff --git a/module/repo/view/linkbug.html.php b/module/repo/view/linkbug.html.php index d2c7650410..f3fbefc7a9 100644 --- a/module/repo/view/linkbug.html.php +++ b/module/repo/view/linkbug.html.php @@ -15,6 +15,7 @@
    diff --git a/module/repo/view/linkstory.html.php b/module/repo/view/linkstory.html.php index 9cd9d0cc0a..4fd4a6b133 100644 --- a/module/repo/view/linkstory.html.php +++ b/module/repo/view/linkstory.html.php @@ -15,6 +15,7 @@
    diff --git a/module/repo/view/linktask.html.php b/module/repo/view/linktask.html.php index 0256b43a5b..7d21568668 100644 --- a/module/repo/view/linktask.html.php +++ b/module/repo/view/linktask.html.php @@ -15,6 +15,7 @@
    diff --git a/module/story/control.php b/module/story/control.php index 443d827e39..014eb38c1f 100755 --- a/module/story/control.php +++ b/module/story/control.php @@ -389,7 +389,7 @@ class story extends control foreach($this->config->story->fromObjects[$fromObjectIDKey]['fields'] as $storyField => $fromObjectField) { - $$storyField = $fromObject->{$fromObjectField}; + $storyField = $fromObject->{$fromObjectField}; } } @@ -1052,6 +1052,7 @@ class story extends control unset($stories[$id]); } if(!empty($twins)) echo js::alert(sprintf($this->lang->story->batchEditTip, $twins)); + if(empty($stories)) return print(js::locate($this->session->storyList)); $this->loadModel('branch'); if($productID and !$executionID) @@ -2457,6 +2458,7 @@ class story extends control $this->view->type = $type; $this->view->stories2Link = $stories2Link; $this->view->users = $this->loadModel('user')->getPairs('noletter'); + $this->view->storyType = $storyType; $this->display(); } diff --git a/module/story/js/batchedit.js b/module/story/js/batchedit.js index 5a92791404..7a16ff6e67 100644 --- a/module/story/js/batchedit.js +++ b/module/story/js/batchedit.js @@ -31,7 +31,7 @@ function loadBranches(product, branch, storyID) if(!branch) branch = 0; var currentModuleID = $('#modules' + storyID).val(); - moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + product + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + storyID + '&needManage=false&extra=¤tModuleID=' + currentModuleID); + moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + product + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + storyID + '&needManage=false&extra=nodeleted¤tModuleID=' + currentModuleID); $('#modules' + storyID).parent('td').load(moduleLink, function(){$('#modules' + storyID).chosen();}); planID = $('#plans' + storyID).val(); diff --git a/module/story/js/create.js b/module/story/js/create.js index f1b15d12d4..939934970a 100644 --- a/module/story/js/create.js +++ b/module/story/js/create.js @@ -59,6 +59,12 @@ $(function() return false; }); + $('#product').on('change', function(){ + var productID = $('#product').val(); + var viewLink = createLink('story', 'create', 'productID=' + productID + '&branch=all'); + self.location.href = viewLink; + }); + $('#module').on('change', function(){ loadURS(); }); @@ -287,7 +293,7 @@ function loadModuleForTwins(productID, branch, branchIndex) { /* Load module */ var currentModule = 0; - var moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + branchIndex + '&needManage=false&extra=¤tModuleID=' + currentModule); + var moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + branchIndex + '&needManage=false&extra=nodeleted¤tModuleID=' + currentModule); if(branchIndex > 0) { var $moduleIDBox = $('.addBranchesBox'+ branchIndex +' #moduleIdBox'); diff --git a/module/story/model.php b/module/story/model.php index cf705af348..e676929965 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -352,7 +352,7 @@ class storyModel extends model if($executionID != 0) { $this->linkStory($executionID, $this->post->product, $storyID); - if($this->config->systemMode == 'new' and $executionID != $this->session->project) $this->linkStory($this->session->project, $this->post->product, $storyID); + if($this->config->systemMode == 'ALM' and $executionID != $this->session->project) $this->linkStory($this->session->project, $this->post->product, $storyID); $this->loadModel('kanban'); @@ -603,6 +603,11 @@ class storyModel extends model if(is_array($story->{$extendField->field})) $story->{$extendField->field} = join(',', $story->{$extendField->field}); $story->{$extendField->field} = htmlSpecialString($story->{$extendField->field}); + if(empty($story->{$extendField->field})) + { + dao::$errors[] = sprintf($this->lang->error->notempty, $extendField->name); + return false; + } } foreach(explode(',', $this->config->story->create->requiredFields) as $field) @@ -6039,7 +6044,7 @@ class storyModel extends model if($result == 'reject') { $now = helper::now(); - $reason = (empty($reason) and isset($story->closedReason)) ? $story->closedReason : $reason; + $reason = (!empty($story->closedReason)) ? $story->closedReason : $reason; $story->status = 'closed'; $story->closedBy = $this->app->user->account; diff --git a/module/story/view/header.html.php b/module/story/view/header.html.php index 6b6835039c..d014cb0b45 100644 --- a/module/story/view/header.html.php +++ b/module/story/view/header.html.php @@ -191,7 +191,7 @@ function loadProductModules(productID, branch) currentModule = $('#module').val(); } - var moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=¤tModuleID=' + currentModule); + var moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=nodeleted¤tModuleID=' + currentModule); var $moduleIDBox = $('#moduleIdBox'); $moduleIDBox.load(moduleLink, function() { diff --git a/module/story/view/linkstory.html.php b/module/story/view/linkstory.html.php index 3c5fb388fe..9142415c91 100644 --- a/module/story/view/linkstory.html.php +++ b/module/story/view/linkstory.html.php @@ -24,6 +24,13 @@
    + +
    +

    + story->noRequirement : $lang->story->noStory;?> +

    +
    +
    @@ -83,6 +90,7 @@ + - + diff --git a/module/zanode/view/getvnc.html.php b/module/zanode/view/getvnc.html.php index b439daa0f4..4eb04c8fbd 100644 --- a/module/zanode/view/getvnc.html.php +++ b/module/zanode/view/getvnc.html.php @@ -12,7 +12,7 @@ ?> getModuleRoot() . 'common/view/header.lite.html.php';?>
    - ";?> + ";?>
    \ No newline at end of file diff --git a/module/zanode/view/view.html.php b/module/zanode/view/view.html.php index b1a066fc59..b5a2a99303 100644 --- a/module/zanode/view/view.html.php +++ b/module/zanode/view/view.html.php @@ -137,7 +137,7 @@ $account = strpos($zanode->osName, "windows") ? $config->zanode->defaultWinAccou
    - zanode->init->initSuccessNoticeTitle, "{$lang->zanode->manual}", html::a(helper::createLink('testcase', 'automation', "", '', true), $lang->zanode->automation, '', "class='iframe' title='{$lang->zanode->automation}' data-width='50%'", '')); ?> + zanode->init->initSuccessNoticeTitle, "{$lang->zanode->manual}", html::a(helper::createLink('testcase', 'automation', "", '', true), $lang->zanode->automation, '', "class='iframe' title='{$lang->zanode->automation}' data-width='50%'", '')); ?> zanode->init->initFailNoticeTitle . '
    ' . $lang->zanode->init->initFailNoticeDesc;?>
    diff --git a/test/class/user.class.php b/test/class/user.class.php index 81ce7d3145..2d562ddf00 100755 --- a/test/class/user.class.php +++ b/test/class/user.class.php @@ -854,7 +854,7 @@ class userTest * @access public * @return void */ - public function checkProductPrivTest($product, $account, $groups, $teams, $stakeholders, $whiteList) + public function checkProductPrivTest($product, $account, $groups = '', $teams = '', $stakeholders = '', $whiteList = '') { return $this->objectModel->checkProductPriv($product, $account, $groups, $teams, $stakeholders, $whiteList); } @@ -882,14 +882,33 @@ class userTest * @param int $projectID * @param array $stakeholders * @param array $whiteList + * @param array $admins * @access public * @return void */ - public function getProgramAuthedUsersTest($programID, $stakeholders, $whiteList) + public function getProgramAuthedUsersTest($programID, $stakeholders, $whiteList, $admins) { global $tester; $program = $tester->loadModel('program')->getByID($programID); - return $this->objectModel->getProgramAuthedUsers($program, $stakeholders, $whiteList); + return $this->objectModel->getProgramAuthedUsers($program, $stakeholders, $whiteList, $admins); + } + + /** + * getSprintAuthedUsersTest + * + * @param int $sprintID + * @param array $stakeholders + * @param array $teams + * @param array $whiteList + * @param array $admins + * @access public + * @return void + */ + public function getSprintAuthedUsersTest($sprintID, $stakeholders, $teams, $whiteList, $admins) + { + global $tester; + $sprint = $tester->loadModel('execution')->getByID($sprintID); + return $this->objectModel->getSprintAuthedUsers($sprint, $stakeholders, $teams, $whiteList, $admins); } /** @@ -902,11 +921,11 @@ class userTest * @access public * @return void */ - public function getProductViewListUsersTest($productID, $teams, $stakeholders, $whiteList) + public function getProductViewListUsersTest($productID, $teams, $stakeholders, $whiteList, $admins) { global $tester; $product = $tester->loadModel('product')->getByID($productID); - return $this->objectModel->getProductViewListUsers($product, $teams, $stakeholders, $whiteList); + return $this->objectModel->getProductViewListUsers($product, $teams, $stakeholders, $whiteList, $admins); } /** @@ -919,7 +938,7 @@ class userTest * @access public * @return void */ - public function getTeamMemberPairsTest($objectID, $type, $params, $usersToAppended) + public function getTeamMemberPairsTest($objectID, $type, $params = '', $usersToAppended = array()) { return $this->objectModel->getTeamMemberPairs($objectID, $type, $params, $usersToAppended); } @@ -945,9 +964,9 @@ class userTest * * @param string $type * @access public - * @return void + * @return array */ - public function getUserTemplates($type) + public function getUserTemplatesTest($type) { return $this->objectModel->getUserTemplates($type); } @@ -1104,4 +1123,22 @@ class userTest { return $this->objectModel->identifyByCookie(); } + + /** + * test of isClickable. + * + * @param int $userID + * @param string $action + * @access public + * @return bool + */ + public function isClickableTest($userID, $action = '') + { + global $tester; + + $user = $tester->loadModel('user')->getById($userID, 'id'); + if($userID == 10) $user->ranzhi = ''; + + return $this->objectModel->isClickable($user, $action); + } } diff --git a/test/lib/yaml.class.php b/test/lib/yaml.class.php index e1feba8311..98371f173d 100644 --- a/test/lib/yaml.class.php +++ b/test/lib/yaml.class.php @@ -253,11 +253,12 @@ class yaml * Build yaml file and insert table. * * @param int $rows + * @param string $dataDirYaml The yaml file names in the data directory * @param string $version * @access public * @return void */ - public function gen($rows, $version = '1.0') + public function gen($rows, $dataDirYaml = '') { $runFileDir = dirname(getcwd() . DS . $_SERVER['SCRIPT_FILENAME']); $runFileName = str_replace(strrchr($_SERVER['SCRIPT_FILENAME'], "."), "", $_SERVER['SCRIPT_FILENAME']); @@ -270,11 +271,12 @@ class yaml $yamlDataArr['title'] = "zt_{$this->tableName}"; $yamlDataArr['author'] = "auto_{$runFileName}"; - $yamlDataArr['version'] = $version; + $yamlDataArr['version'] = '1.0'; if(empty($this->fields->fieldArr)) { $yamlFile = dirname(dirname(__FILE__)) . "/data/{$this->tableName}.yaml"; + if($dataDirYaml) $yamlFile = dirname(dirname(__FILE__)) . "/data/{$dataDirYaml}.yaml"; } else { diff --git a/test/model/user/checkproductpriv.php b/test/model/user/checkproductpriv.php index c15930dd19..41b638e00d 100755 --- a/test/model/user/checkproductpriv.php +++ b/test/model/user/checkproductpriv.php @@ -2,6 +2,8 @@ gen(10); +zdTable('user')->gen(200); su('admin'); /** @@ -14,7 +16,7 @@ pid=1 传入产品、用户名,判断test3用户是否对此产品有权限 >> 0 传入产品、用户名,判断test2用户是否对此产品有权限 >> 1 传入产品、用户名、干系人、白名单,判断user10用户是否对此产品有权限 >> 1 -传入产品、用户名、干系人、白名单,判断user60用户是否对此产品有权限 >> 1 +传入产品、用户名、干系人、白名单,判断user60用户是否对此产品有权限 >> 0 */ @@ -32,4 +34,4 @@ r($user->checkProductPrivTest('', 'admin')) && p() && e('1'); //传入admi r($user->checkProductPrivTest($product, 'test3')) && p() && e('0'); //传入产品、用户名,判断test3用户是否对此产品有权限 r($user->checkProductPrivTest($product, 'test2')) && p() && e('1'); //传入产品、用户名,判断test2用户是否对此产品有权限 r($user->checkProductPrivTest($product, 'user10', array(), array(), $stakeholders)) && p() && e('1'); //传入产品、用户名、干系人、白名单,判断user10用户是否对此产品有权限 -r($user->checkProductPrivTest($product, 'user60', array(), array(), $stakeholders, array(), $whiteList)) && p() && e('1'); //传入产品、用户名、干系人、白名单,判断user60用户是否对此产品有权限 \ No newline at end of file +r($user->checkProductPrivTest($product, 'user60', array(), array(), $stakeholders, array(), $whiteList)) && p() && e('0'); //传入产品、用户名、干系人、白名单,判断user60用户是否对此产品有权限 diff --git a/test/model/user/getcancreatestoryusers.php b/test/model/user/getcancreatestoryusers.php index 1121d5c858..548acdea49 100755 --- a/test/model/user/getcancreatestoryusers.php +++ b/test/model/user/getcancreatestoryusers.php @@ -2,6 +2,7 @@ gen(1000); su('admin'); /** @@ -10,9 +11,9 @@ title=测试 userModel->getCanCreateStoryUsers(); cid=1 pid=1 -查找系统中有权限创建、批量创建需求的用户 >> A:admin;T:产品主管48 +查找系统中有权限创建、批量创建需求的用户 >> A:admin;T:研发主管48 */ $user = new userTest(); -r($user->getCanCreateStoryUsersTest()) && p('admin;td48') && e('A:admin;T:产品主管48'); //查找系统中有权限创建、批量创建需求的用户 \ No newline at end of file +r($user->getCanCreateStoryUsersTest()) && p('admin;td48') && e('A:admin;T:研发主管48'); //查找系统中有权限创建、批量创建需求的用户 \ No newline at end of file diff --git a/test/model/user/getpersonaldata.php b/test/model/user/getpersonaldata.php index 741dd421f7..f685b83216 100755 --- a/test/model/user/getpersonaldata.php +++ b/test/model/user/getpersonaldata.php @@ -2,6 +2,11 @@ gen(500); +zdTable('story')->gen(400); +zdTable('case')->gen(400); +zdTable('bug')->gen(300); + su('admin'); /** @@ -10,9 +15,9 @@ title=测试 userModel::getPersonalData(); cid=1 pid=1 -获取admin用户的createdBugs数量 >> 270 +获取admin用户的createdBugs数量 >> 30 获取test2用户createdCases数量 >> 4 -当获取一个空用户的数据时,系统默认返回当前登录用户的数据 >> 2 +当获取一个空用户的数据时,系统默认返回当前登录用户的数据 >> 3 */ $user = new userTest(); @@ -20,6 +25,6 @@ $adminData = $user->getPersonalDataTest('admin'); $test2Data = $user->getPersonalDataTest('test2'); $emptyData = $user->getPersonalDataTest(''); -r($adminData) && p('createdBugs') && e('270'); //获取admin用户的createdBugs数量 +r($adminData) && p('createdBugs') && e('30'); //获取admin用户的createdBugs数量 r($test2Data) && p('createdCases') && e('4'); //获取test2用户createdCases数量 -r($emptyData) && p('createdTodos') && e('2'); //当获取一个空用户的数据时,系统默认返回当前登录用户的数据 \ No newline at end of file +r($emptyData) && p('createdTodos') && e('3'); //当获取一个空用户的数据时,系统默认返回当前登录用户的数据 \ No newline at end of file diff --git a/test/model/user/getproductviewlistusers.php b/test/model/user/getproductviewlistusers.php index a2b34ef1e8..23e12a7a5c 100755 --- a/test/model/user/getproductviewlistusers.php +++ b/test/model/user/getproductviewlistusers.php @@ -2,6 +2,8 @@ gen(10); +zdTable('user')->gen(100); su('admin'); /** @@ -14,6 +16,7 @@ pid=1 获取对ID为1的产品有权限的用户 >> test9 获取对ID为1的产品有权限的用户 >> admin 获取对ID为2的产品有权限的用户 >> astaw +获取对ID为2的产品有权限的用户 >> test20 */ @@ -28,7 +31,11 @@ $whiteList['user35'] = 'user35'; $whiteList['user35'] = 'user35'; $whiteList['astaw'] = 'astaw'; -r(count($user->getProductViewListUsersTest(1, $stakeholders, $teams, $whiteList))) && p() && e('11'); //获取对ID为1的产品有权限的用户 -r($user->getProductViewListUsersTest(1, $stakeholders, $teams, $whiteList)) && p('test9') && e('test9'); //获取对ID为1的产品有权限的用户 -r($user->getProductViewListUsersTest(1, $stakeholders, $teams, $whiteList)) && p('admin') && e('admin'); //获取对ID为1的产品有权限的用户 -r($user->getProductViewListUsersTest(2, $stakeholders, $teams, $whiteList)) && p('astaw') && e('astaw'); //获取对ID为2的产品有权限的用户 \ No newline at end of file +$admins['test20'] = 'test20'; +$admins['test21'] = 'test21'; + +r(count($user->getProductViewListUsersTest(1, $stakeholders, $teams, $whiteList, array()))) && p() && e('11'); //获取对ID为1的产品有权限的用户 +r($user->getProductViewListUsersTest(1, $stakeholders, $teams, $whiteList, array())) && p('test9') && e('test9'); //获取对ID为1的产品有权限的用户 +r($user->getProductViewListUsersTest(1, $stakeholders, $teams, $whiteList, array())) && p('admin') && e('admin'); //获取对ID为1的产品有权限的用户 +r($user->getProductViewListUsersTest(2, $stakeholders, $teams, $whiteList, array())) && p('astaw') && e('astaw'); //获取对ID为2的产品有权限的用户 +r($user->getProductViewListUsersTest(2, $stakeholders, $teams, $whiteList, $admins)) && p('test20') && e('test20'); //获取对ID为2的产品有权限的用户 \ No newline at end of file diff --git a/test/model/user/getprogramauthedusers.php b/test/model/user/getprogramauthedusers.php index 2b8a97c2c2..b59325ef62 100755 --- a/test/model/user/getprogramauthedusers.php +++ b/test/model/user/getprogramauthedusers.php @@ -2,6 +2,8 @@ gen(10, 'program'); +zdTable('user')->gen(200); su('admin'); /** @@ -10,7 +12,7 @@ title=测试 userModel->getProgramAuthedUsers(); cid=1 pid=1 -获取对ID为1的项目集有权限的用户数量 >> 6 +获取对ID为1的项目集有权限的用户数量 >> 7 获取对ID为1的项目集有权限的用户 >> test9 获取对ID为1的项目集有权限的用户 >> admin 获取对ID为2的项目集有权限的用户 >> astaw @@ -25,7 +27,11 @@ $whiteList['user35'] = 'user35'; $whiteList['user35'] = 'user35'; $whiteList['astaw'] = 'astaw'; -r(count($user->getProgramAuthedUsersTest(1, $stakeholders, $whiteList))) && p() && e('6'); //获取对ID为1的项目集有权限的用户数量 -r($user->getProgramAuthedUsersTest(1, $stakeholders, $whiteList)) && p('test9') && e('test9'); //获取对ID为1的项目集有权限的用户 -r($user->getProgramAuthedUsersTest(1, $stakeholders, $whiteList)) && p('admin') && e('admin'); //获取对ID为1的项目集有权限的用户 -r($user->getProgramAuthedUsersTest(2, $stakeholders, $whiteList)) && p('astaw') && e('astaw'); //获取对ID为2的项目集有权限的用户 \ No newline at end of file +$admins['test20'] = 'test20'; +$admins['test21'] = 'test21'; + +r(count($user->getProgramAuthedUsersTest(1, $stakeholders, $whiteList, array()))) && p() && e('7'); //获取对ID为1的项目集有权限的用户数量 +r($user->getProgramAuthedUsersTest(1, $stakeholders, $whiteList, array())) && p('test9') && e('test9'); //获取对ID为1的项目集有权限的用户 +r($user->getProgramAuthedUsersTest(1, $stakeholders, $whiteList, array())) && p('admin') && e('admin'); //获取对ID为1的项目集有权限的用户 +r($user->getProgramAuthedUsersTest(2, $stakeholders, $whiteList, array())) && p('astaw') && e('astaw'); //获取对ID为2的项目集有权限的用户 +r($user->getProgramAuthedUsersTest(2, $stakeholders, $whiteList, $admins)) && p('test21') && e('test21'); //获取对ID为2的项目集有权限的用户 diff --git a/test/model/user/getprojectauthedusers.php b/test/model/user/getprojectauthedusers.php index 90c02dcdec..d3d193ea1f 100755 --- a/test/model/user/getprojectauthedusers.php +++ b/test/model/user/getprojectauthedusers.php @@ -2,6 +2,8 @@ gen(10); +zdTable('user')->gen(200); su('admin'); /** @@ -29,4 +31,4 @@ $whiteList['astaw'] = 'astaw'; r($user->getProjectAuthedUsersTest(1, $stakeholders, $teams, $whiteList)) && p('test9') && e('test9'); //获取对ID为1的产品有权限的用户 r($user->getProjectAuthedUsersTest(1, $stakeholders, $teams, $whiteList)) && p('admin') && e('admin'); //获取对ID为1的产品有权限的用户 -r($user->getProjectAuthedUsersTest(2, $stakeholders, $teams, $whiteList)) && p('astaw') && e('astaw'); //获取对ID为2的产品有权限的用户 \ No newline at end of file +r($user->getProjectAuthedUsersTest(2, $stakeholders, $teams, $whiteList)) && p('astaw') && e('astaw'); //获取对ID为2的产品有权限的用户 diff --git a/test/model/user/getsprintauthedusers.php b/test/model/user/getsprintauthedusers.php new file mode 100755 index 0000000000..cffb119ef7 --- /dev/null +++ b/test/model/user/getsprintauthedusers.php @@ -0,0 +1,38 @@ +#!/usr/bin/env php +gen(300, 'execution'); +zdTable('user')->gen(200); +su('admin'); + +/** + +title=测试 userModel->getSprintAuthedUsers(); +cid=1 +pid=1 + +获取对ID为101的执行有权限的用户 >> test9 +获取对ID为101的执行有权限的用户 >> admin +获取对ID为201的执行有权限的用户 >> astaw +获取对ID为201的执行有权限的用户 >> test21 + +*/ +$user = new userTest(); +$stakeholders['test9'] = 'test9'; +$stakeholders['test10'] = 'test10'; + +$teams['pm7'] = 'pm7'; +$teams['pm8'] = 'pm8'; + +$whiteList['user35'] = 'user35'; +$whiteList['user35'] = 'user35'; +$whiteList['astaw'] = 'astaw'; + +$admins['test20'] = 'test20'; +$admins['test21'] = 'test21'; + +r($user->getSprintAuthedUsersTest(101, $stakeholders, $teams, $whiteList, array())) && p('test9') && e('test9'); //获取对ID为101的执行有权限的用户 +r($user->getSprintAuthedUsersTest(101, $stakeholders, $teams, $whiteList, array())) && p('admin') && e('admin'); //获取对ID为101的执行有权限的用户 +r($user->getSprintAuthedUsersTest(201, $stakeholders, $teams, $whiteList, array())) && p('astaw') && e('astaw'); //获取对ID为201的执行有权限的用户 +r($user->getSprintAuthedUsersTest(201, $stakeholders, $teams, $whiteList, $admins)) && p('test21') && e('test21'); //获取对ID为201的执行有权限的用户 \ No newline at end of file diff --git a/test/model/user/getteammemberpairs.php b/test/model/user/getteammemberpairs.php index 2465a1663a..6d38e65314 100755 --- a/test/model/user/getteammemberpairs.php +++ b/test/model/user/getteammemberpairs.php @@ -2,6 +2,9 @@ gen(10); +zdTable('team')->gen(400); +zdTable('user')->gen(1000); su('admin'); /** @@ -12,6 +15,7 @@ pid=1 获取ID为11的项目的团队成员数量 >> 3 获取ID为11的项目的团队成员数量,追加用户test2 >> 4 +获取ID为11的项目的团队成员数量,追加用户test2 >> project 获取ID为110的执行的团队成员成员 >> T:测试1 */ @@ -19,5 +23,6 @@ pid=1 $user = new userTest(); r(count($user->getTeamMemberPairsTest(11, 'project'))) && p() && e('3'); //获取ID为11的项目的团队成员数量 -r(count($user->getTeamMemberPairsTest(11, 'project', '', array('test2')))) && p() && e('4'); //获取ID为11的项目的团队成员数量,追加用户test2 -r($user->getTeamMemberPairsTest(110, 'execution')) && p('test1') && e('T:测试1'); //获取ID为110的执行的团队成员成员 \ No newline at end of file +r(count($user->getTeamMemberPairsTest(11, 'project', '', array('test2')))) && p() && e('4') && zdTable('project')->gen(100, 'execution' );//获取ID为11的项目的团队成员数量,追加用户test2 +zdTable('project')->gen(100, 'execution' ); +r($user->getTeamMemberPairsTest(110, 'execution')) && p('test1') && e('T:测试1'); //获取ID为110的执行的团队成员成员 diff --git a/test/model/user/getuserdetailsforapi.php b/test/model/user/getuserdetailsforapi.php index 171028a760..155c839af3 100755 --- a/test/model/user/getuserdetailsforapi.php +++ b/test/model/user/getuserdetailsforapi.php @@ -2,6 +2,7 @@ gen(500); su('admin'); /** @@ -10,7 +11,7 @@ title=测试 userModel::getUserDetailsForAPI(); cid=1 pid=1 -获取admin用户的url >> guser-profile-1. +获取admin用户的url >> getuserdetailsforapi 获取test2用户的真实姓名 >> 测试2 获取user10的头像信息 >> http:///home/z/tmp/10.png @@ -19,6 +20,6 @@ $user = new userTest(); $userList = array('admin', 'test2', 'user10', ''); $users = $user->getUserDetailsForAPITest($userList); -r($users) && p('admin:url') && e('guser-profile-1.'); //获取admin用户的url +r($users) && p('admin:url') && e('getuserdetailsforapi'); //获取admin用户的url r($users) && p('test2:realname') && e('测试2'); //获取test2用户的真实姓名 r($users) && p('user10:avatar') && e('http:///home/z/tmp/10.png'); //获取user10的头像信息 \ No newline at end of file diff --git a/test/model/user/getusertemplates.php b/test/model/user/getusertemplates.php index 74e7f78ab9..f3a55414c1 100755 --- a/test/model/user/getusertemplates.php +++ b/test/model/user/getusertemplates.php @@ -2,6 +2,8 @@ gen(10); +zdTable('user')->gen(1000); su('admin'); /** @@ -10,9 +12,16 @@ title=测试 userModel::getUserTemplates(); cid=1 pid=1 - +查询当前用户能够使用的exporttask类型的模板 >> admin +查询当前用户能够使用的story类型的模板 >> dev10 +查询当前用户能够使用的exportbug类型的模板 >> 0 +查询当前用户能够使用的exportstory类型的模板 >> test10 */ -$user = new userTest(); +$typeList = array('exporttask', 'story', 'exportbug', 'exportstory'); -//r() && p('') && e(''); // \ No newline at end of file +$user = new userTest(); +r($user->getUserTemplatesTest($typeList[0])) && p('0:account') && e('admin'); //查询当前用户能够使用的exporttask类型的模板 +r($user->getUserTemplatesTest($typeList[1])) && p('0:account') && e('dev10'); //查询当前用户能够使用的story类型的模板 +r($user->getUserTemplatesTest($typeList[2])) && p('0:account') && e('0'); //查询当前用户能够使用的exportbug类型的模板 +r($user->getUserTemplatesTest($typeList[3])) && p('0:account') && e('test10'); //查询当前用户能够使用的exportstory类型的模板 \ No newline at end of file diff --git a/test/model/user/isclickable.php b/test/model/user/isclickable.php new file mode 100755 index 0000000000..6468463fae --- /dev/null +++ b/test/model/user/isclickable.php @@ -0,0 +1,34 @@ +#!/usr/bin/env php +gen(10); + +/** + +title=测试 userModel::getById(); +cid=1 +pid=1 + +判断用户id为1,action为空时,是否可点击 >> 1 +判断用户id为1,action为unbind,是否可点击 >> 1 +判断用户id为1,action为unlock,是否可点击 >> 0 +判断用户id为1,action为undefind,是否可点击 >> 1 +判断用户id为10,action为unbind,是否可点击 >> 0 +判断用户id为10,action为unlock,是否可点击 >> 0 + +*/ +$actionList[0] = 'unbind'; +$actionList[1] = 'unlock'; +$actionList[2] = 'undefind'; + +$user = new userTest(); + +r($user->isClickableTest(1)) && p() && e('1'); // 判断用户id为1,action为空时,是否可点击 +r($user->isClickableTest(1, $actionList[0])) && p() && e('1'); // 判断用户id为1,action为unbind,是否可点击 +r($user->isClickableTest(1, $actionList[1])) && p() && e('0'); // 判断用户id为1,action为unlock,是否可点击 +r($user->isClickableTest(1, $actionList[2])) && p() && e('1'); // 判断用户id为1,action为undefind,是否可点击 +r($user->isClickableTest(10,$actionList[0])) && p() && e('0'); // 判断用户id为10,action为unbind,是否可点击 +r($user->isClickableTest(10,$actionList[1])) && p() && e('0'); // 判断用户id为10,action为unlock,是否可点击 \ No newline at end of file diff --git a/test/model/user/processaccountsort.php b/test/model/user/processaccountsort.php index bd06572e5e..c99b08a089 100755 --- a/test/model/user/processaccountsort.php +++ b/test/model/user/processaccountsort.php @@ -2,6 +2,7 @@ gen(500); su('admin'); /** @@ -20,5 +21,4 @@ $admin = array( 'role' => 'qa', 'realname' => 'admin' ); -a($user->processAccountSortTest(array('admin'=>$admin)));exit; r($user->processAccountSortTest(array('admin'=>$admin))) && p('admin:account,role') && e('admin,qa'); //获取当前用户信息 \ No newline at end of file diff --git a/test/model/user/saveusertemplate.php b/test/model/user/saveusertemplate.php index 451319d6cb..4f344efe75 100755 --- a/test/model/user/saveusertemplate.php +++ b/test/model/user/saveusertemplate.php @@ -2,7 +2,8 @@ switchDB(); +zdTable('usertpl')->gen(10); +zdTable('user')->gen(500); su('admin'); /** @@ -42,6 +43,4 @@ $tpls3 = $user->saveUserTemplate('task'); r(count($tpls1)) && p() && e('1'); //插入一条Bug用户模板,查看数量 r(count($tpls3)) && p() && e('2'); //插入两条任务类型的用户模板,查看数量 r($tpls2) && p('0:title') && e('Admin的模板二'); //查看插入的模板二的名字 -r($tpls2) && p('0:content') && e('

    这是一段模板内容

    '); //查看插入的模板二的内容 - -$db->restoreDB(); \ No newline at end of file +r($tpls2) && p('0:content') && e('

    这是一段模板内容

    '); //查看插入的模板二的内容 \ No newline at end of file