Merge branch 'master' into 'sgm_sprint195'

# Conflicts:
#   db/update17.0.beta1.sql
This commit is contained in:
李玉春
2022-05-24 06:58:00 +00:00
17 changed files with 169 additions and 51 deletions
+6
View File
@@ -1 +1,7 @@
ALTER TABLE `zt_task` ADD `fromIssue` mediumint(8) unsigned NOT NULL DEFAULT '0' AFTER `fromBug`;
ALTER TABLE `zt_kanbanspace` ADD COLUMN `activatedBy` char(30) NOT NULL AFTER `closedDate`;
ALTER TABLE `zt_kanbanspace` ADD COLUMN `activatedDate` datetime NOT NULL AFTER `activatedBy`;
ALTER TABLE `zt_kanban` ADD COLUMN `activatedBy` char(30) NOT NULL AFTER `closedDate`;
ALTER TABLE `zt_kanban` ADD COLUMN `activatedDate` datetime NOT NULL AFTER `activatedBy`;
+4
View File
@@ -760,6 +760,8 @@ CREATE TABLE `zt_kanbanspace` (
`lastEditedDate` datetime NOT NULL,
`closedBy` char(30) NOT NULL,
`closedDate` datetime NOT NULL,
`activatedBy` char(30) NOT NULL,
`activatedDate` datetime NOT NULL,
`deleted` enum('0', '1') NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
@@ -786,6 +788,8 @@ CREATE TABLE `zt_kanban` (
`lastEditedDate` datetime NOT NULL,
`closedBy` char(30) NOT NULL,
`closedDate` datetime NOT NULL,
`activatedBy` char(30) NOT NULL,
`activatedDate` datetime NOT NULL,
`deleted` enum('0', '1') NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+2 -1
View File
@@ -1,4 +1,5 @@
#tipsModal {margin-top: 10%;}
[lang^='en'] #tipsModal {margin-top: 10%; max-width: 620px;}
[lang^='zh-cn'] #tipsModal {margin-top: 10%; max-width: 530px;}
.chosen-container-single .chosen-single > span {max-width: 100%;}
#copyProjectModal {padding: 0;}
+1 -1
View File
@@ -15,7 +15,7 @@
<?php $defaultURL = $this->createLink('execution', 'task', "execution=$executionID");?>
<?php include '../../common/view/header.html.php';?>
<body>
<div class='modal-dialog mw-700px' id='tipsModal'>
<div class='modal-dialog' id='tipsModal'>
<div class='modal-header'>
<a href='<?php echo $defaultURL;?>' class='close'><i class="icon icon-close"></i></a>
<h4 class='modal-title' id='myModalLabel'><?php echo $lang->execution->tips;?></h4>
+1 -1
View File
@@ -1,4 +1,4 @@
<div style='margin: 0 auto; max-width: 580px'>
<div style='margin: 0 auto; max-width: <?php echo $this->app->getClientLang() == 'zh-cn' ? '500px' : '580px';?>'>
<p><strong><?php echo $lang->execution->afterInfo;?></strong></p>
<div>
<?php echo html::a($this->createLink('execution', 'team', "executionID=$executionID"), $lang->execution->setTeam, '', "class='btn' data-app='execution'");?>
+2
View File
@@ -624,6 +624,7 @@ $lang->resource->kanban->sortSpace = 'sortSpace';
$lang->resource->kanban->create = 'create';
$lang->resource->kanban->edit = 'edit';
$lang->resource->kanban->view = 'view';
$lang->resource->kanban->activate = 'activate';
$lang->resource->kanban->close = 'close';
$lang->resource->kanban->delete = 'delete';
$lang->resource->kanban->createRegion = 'createRegion';
@@ -712,6 +713,7 @@ $lang->kanban->methodorder[220] = 'setColumnWidth';
$lang->kanban->methodOrder[225] = 'batchCreateCard';
$lang->kanban->methodorder[230] = 'import';
$lang->kanban->methodorder[235] = 'enableArchived';
$lang->kanban->methodorder[240] = 'activate';
/* Execution. */
$lang->resource->execution = new stdclass();
+1
View File
@@ -40,6 +40,7 @@ $config->kanban->editor->createspace = array('id' => 'desc', 'tools' => 'simple
$config->kanban->editor->editspace = array('id' => 'desc', 'tools' => 'simpleTools');
$config->kanban->editor->closespace = array('id' => 'comment', 'tools' => 'simpleTools');
$config->kanban->editor->createcard = array('id' => 'desc', 'tools' => 'simpleTools');
$config->kanban->editor->activate = array('id' => 'comment', 'tools' => 'simpleTools');
$config->kanban->editor->close = array('id' => 'comment', 'tools' => 'simpleTools');
$config->kanban->editor->editcard = array('id' => 'desc', 'tools' => 'simpleTools');
$config->kanban->editor->viewcard = array('id' => 'comment', 'tools' => 'simpleTools');
+30
View File
@@ -239,6 +239,36 @@ class kanban extends control
$this->display();
}
/*
* Activate a kanban.
*
* @param int $kanbanID
* @access public
* @return void
*/
public function activate($kanbanID)
{
$this->loadModel('action');
if(!empty($_POST))
{
$changes = $this->kanban->activate($kanbanID);
if(dao::isError()) return print(js::error(dao::getError()));
$actionID = $this->action->create('kanban', $kanbanID, 'activated', $this->post->comment);
$this->action->logHistory($actionID, $changes);
return print(js::reload('parent.parent'));
}
$this->view->kanban = $this->kanban->getByID($kanbanID);
$this->view->actions = $this->action->getList('kanban', $kanbanID);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
}
/*
* Close a kanban.
*
+1
View File
@@ -8,6 +8,7 @@ $lang->kanban->deleteSpace = 'Delete Space';
$lang->kanban->sortSpace = 'Sort Space';
$lang->kanban->edit = 'Edit Kanban';
$lang->kanban->view = 'View Kanban';
$lang->kanban->activate = 'Activate Kanban';
$lang->kanban->close = 'Close Kanban';
$lang->kanban->delete = 'Delete Kanban';
$lang->kanban->createRegion = 'Create Region';
+1
View File
@@ -8,6 +8,7 @@ $lang->kanban->deleteSpace = '删除空间';
$lang->kanban->sortSpace = '空间排序';
$lang->kanban->edit = '设置看板';
$lang->kanban->view = '查看看板';
$lang->kanban->activate = '激活看板';
$lang->kanban->close = '关闭看板';
$lang->kanban->delete = '删除看板';
$lang->kanban->createRegion = '新增区域';
+36 -3
View File
@@ -2053,6 +2053,37 @@ class kanbanModel extends model
}
}
/**
* Activate a kanban.
*
* @param int $kanbanID
* @access public
* @return array
*/
function activate($kanbanID)
{
$kanbanID = (int)$kanbanID;
$oldKanban = $this->getByID($kanbanID);
$now = helper::now();
$kanban = fixer::input('post')
->setDefault('status', 'active')
->setDefault('activatedBy', $this->app->user->account)
->setDefault('activatedDate', $now)
->setDefault('closedBy', '')
->setDefault('closedDate', '0000-00-00 00:00:00')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->remove('comment')
->get();
$this->dao->update(TABLE_KANBAN)->data($kanban)
->autoCheck()
->where('id')->eq($kanbanID)
->exec();
if(!dao::isError()) return common::createChanges($oldKanban, $kanban);
}
/**
* Close a kanban.
*
@@ -2069,6 +2100,8 @@ class kanbanModel extends model
->setDefault('status', 'closed')
->setDefault('closedBy', $this->app->user->account)
->setDefault('closedDate', $now)
->setDefault('activatedBy', '')
->setDefault('activatedDate', '0000-00-00 00:00:00')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->remove('comment')
@@ -2950,7 +2983,7 @@ class kanbanModel extends model
$CRKanban = !(isset($this->config->CRKanban) and $this->config->CRKanban == '0' and $kanban->status == 'closed');
$printRegionBtn = ($CRKanban and (common::hasPriv('kanban', 'createRegion') or $printSetHeightBtn or common::hasPriv('kanban', 'performable') or common::hasPriv('kanban', 'enableArchived') or common::hasPriv('kanban', 'import') or common::hasPriv('kanban', 'setColumnWidth')));
$printKanbanBtn = (common::hasPriv('kanban', 'edit') or common::hasPriv('kanban', 'close') or common::hasPriv('kanban', 'delete'));
$printKanbanBtn = (common::hasPriv('kanban', 'edit') or ($kanban->status == 'active' and common::hasPriv('kanban', 'close')) or common::hasPriv('kanban', 'delete') or ($kanban->status == 'closed' and common::hasPriv('kanban', 'activate')));
if($printRegionBtn or $printKanbanBtn)
{
@@ -2970,9 +3003,9 @@ class kanbanModel extends model
if(common::hasPriv('kanban', 'performable') and $CRKanban) $actions .= '<li>' . html::a(helper::createLink('kanban', 'performable', "kanbanID=$kanban->id", '', true), '<i class="icon icon-checked"></i>' . $this->lang->kanban->manageProgress, '', "class='iframe btn btn-link' data-width=40%") . '</li>';
$kanbanActions = '';
$attr = $kanban->status == 'closed' ? "disabled='disabled'" : '';
if(common::hasPriv('kanban', 'edit')) $kanbanActions .= '<li>' . html::a(helper::createLink('kanban', 'edit', "kanbanID=$kanban->id", '', true), '<i class="icon icon-edit"></i>' . $this->lang->kanban->edit, '', "class='iframe btn btn-link' data-width='75%'") . '</li>';
if(common::hasPriv('kanban', 'close')) $kanbanActions .= '<li>' . html::a(helper::createLink('kanban', 'close', "kanbanID=$kanban->id", '', true), '<i class="icon icon-off"></i>' . $this->lang->kanban->close, '', "class='iframe btn btn-link' $attr") . '</li>';
if(common::hasPriv('kanban', 'close') and $kanban->status == 'active') $kanbanActions .= '<li>' . html::a(helper::createLink('kanban', 'close', "kanbanID=$kanban->id", '', true), '<i class="icon icon-off"></i>' . $this->lang->kanban->close, '', "class='iframe btn btn-link'") . '</li>';
if(common::hasPriv('kanban', 'activate') and $kanban->status == 'closed') $kanbanActions .= '<li>' . html::a(helper::createLink('kanban', 'activate', "kanbanID=$kanban->id", '', true), '<i class="icon icon-magic"></i>' . $this->lang->kanban->activate, '', "class='iframe btn btn-link'") . '</li>';
if(common::hasPriv('kanban', 'delete')) $kanbanActions .= '<li>' . html::a(helper::createLink('kanban', 'delete', "kanbanID=$kanban->id"), '<i class="icon icon-trash"></i>' . $this->lang->kanban->delete, 'hiddenwin', "class='btn btn-link'") . '</li>';
if($kanbanActions)
{
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* The activate file of kanban module of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Mengyi Liu <liumengyi@easycorp.ltd>
* @package kanban
* @version $Id: activate.html.php 935 2022-05-25 13:18:24Z $
* @link https://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
<h2>
<span class='label label-id'><?php echo $kanban->id;?></span>
<?php echo "<span title='$kanban->name'>" . $kanban->name . '</span>';?>
</h2>
</div>
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->comment;?></th>
<td colspan='2'><?php echo html::textarea('comment', '', "rows='6'");?></td>
</tr>
<tr>
<td colspan='3' class='text-center form-actions'>
<?php echo html::submitButton($lang->kanban->activate);?>
</td>
</tr>
</table>
</form>
<hr class='small' />
<div class='main'><?php include '../../common/view/action.html.php';?></div>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
+18 -8
View File
@@ -68,27 +68,37 @@
<?php endif;?>
<strong title='<?php echo $kanban->name;?>'><?php echo $kanban->name;?></strong>
</div>
<?php $canActions = (common::hasPriv('kanban','edit') or common::hasPriv('kanban','close') or common::hasPriv('kanban','delete'));?>
<?php if($canActions):?>
<?php
$canEdit = common::hasPriv('kanban','edit');
$canDelete = common::hasPriv('kanban','delete');
$canClose = (common::hasPriv('kanban', 'close') and $kanban->status == 'active');
$canActivate = (common::hasPriv('kanban', 'activate') and $kanban->status == 'closed');
?>
<?php if($canEdit or $canDelete or $canClose or $canActivate):?>
<div class='kanban-actions kanban-actions<?php echo $kanbanID;?>'>
<div class='dropdown'>
<?php echo html::a('javascript:;', "<i class='icon icon-ellipsis-v'></i>", '', "data-toggle='dropdown' class='btn btn-link'");?>
<ul class='dropdown-menu <?php echo $kanbanCount % 4 == 0 ? 'pull-left' : 'pull-right';?>'>
<?php
if(common::hasPriv('kanban','edit'))
if($canEdit)
{
echo '<li>';
common::printLink('kanban', 'edit', "kanbanID={$kanban->id}", '<i class="icon icon-edit"></i> ' . $lang->kanban->edit, '', "class='iframe' data-width='75%'", '', true);
echo '</li>';
}
if(common::hasPriv('kanban','close'))
if($canClose)
{
$class = $kanban->status == 'closed' ? 'disabled' : '';
echo "<li class='{$class}'>";
common::printLink('kanban', 'close', "kanbanID={$kanban->id}", '<i class="icon icon-off"></i> ' . $lang->kanban->close, '', "class='iframe {$class}' data-width='75%'", '', true);
echo "<li>";
common::printLink('kanban', 'close', "kanbanID={$kanban->id}", '<i class="icon icon-off"></i> ' . $lang->kanban->close, '', "class='iframe' data-width='75%'", '', true);
echo '</li>';
}
if(common::hasPriv('kanban','delete'))
if($canActivate)
{
echo "<li>";
common::printLink('kanban', 'activate', "kanbanID={$kanban->id}", '<i class="icon icon-magic"></i> ' . $lang->kanban->activate, '', "class='iframe' data-width='75%'", '', true);
echo '</li>';
}
if($canDelete)
{
echo '<li>';
common::printLink('kanban', 'delete', "kanbanID={$kanban->id}", '<i class="icon icon-trash"></i> ' . $lang->kanban->delete, 'hiddenwin');
+1 -1
View File
@@ -20,7 +20,7 @@ $config->testcase->export->listFields = array('type', 'stage', 'pri', 'status'
$config->testcase->exportFields = '
id, product, branch, module, story,
title, precondition, stepDesc, stepExpect, real, keywords,
pri, type, stage, status, bugsAB, resultsAB, stepNumberAB, lastRunResult, openedBy, openedDate,
pri, type, stage, status, bugsAB, resultsAB, stepNumberAB, lastRunner, lastRunDate, lastRunResult, openedBy, openedDate,
lastEditedBy, lastEditedDate, version, linkCase, files';
$config->testcase->customCreateFields = 'story,stage,pri,keywords';
+10 -17
View File
@@ -1455,23 +1455,15 @@ class testcase extends control
/* Get cases. */
if($this->session->testcaseOnlyCondition)
{
if($taskID)
{
$caseIDList = $this->dao->select('`case`')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->fetchPairs();
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($this->session->testcaseQueryCondition)->andWhere('id')->in($caseIDList)
->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi()
->orderBy($orderBy)
->beginIF($this->post->limit)->limit($this->post->limit)->fi()
->fetchAll('id');
}
else
{
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($this->session->testcaseQueryCondition)
->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi()
->orderBy($orderBy)
->beginIF($this->post->limit)->limit($this->post->limit)->fi()
->fetchAll('id');
}
$caseIDList = array();
if($taskID) $caseIDList = $this->dao->select('`case`')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->fetchPairs();
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($this->session->testcaseQueryCondition)
->beginIF($taskID)->andWhere('id')->in($caseIDList)->fi()
->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi()
->orderBy($orderBy)
->beginIF($this->post->limit)->limit($this->post->limit)->fi()
->fetchAll('id');
}
else
{
@@ -1590,6 +1582,7 @@ class testcase extends control
if(isset($caseLang->statusList[$case->status])) $case->status = $this->processStatus('testcase', $case);
if(isset($users[$case->openedBy])) $case->openedBy = $users[$case->openedBy];
if(isset($users[$case->lastEditedBy])) $case->lastEditedBy = $users[$case->lastEditedBy];
if(isset($users[$case->lastRunner])) $case->lastRunner = $users[$case->lastRunner];
if(isset($caseLang->resultList[$case->lastRunResult])) $case->lastRunResult = $caseLang->resultList[$case->lastRunResult];
$case->bugsAB = $case->bugs; unset($case->bugs);
Regular → Executable
-16
View File
@@ -291,22 +291,6 @@ class groupTest
return $objects;
}
/**
* Update view priv.
*
* @param int $groupID
* @access public
* @return bool
*/
public function updateViewTest($groupID)
{
$objects = $this->objectModel->updateView($groupID);
if(dao::isError()) return dao::getError();
return $objects;
}
/**
* Update privilege by module.
*
Regular → Executable
+15 -3
View File
@@ -1,7 +1,6 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/group.class.php';
su('admin');
/**
@@ -12,6 +11,19 @@ pid=1
*/
$group = new groupTest();
global $tester;
$tester->loadModel('group');
r($group->updateViewTest()) && p() && e();
$_POST['allchecker'] = 1;
$tester->group->updateView(1);
$group1 = $tester->group->getByID(1);
$_POST['actions']['task']['create'] = 'create';
$tester->group->updateView(1);
$group2 = $tester->group->getByID(1);
r(count($group1->acl)) && p() && e('2'); // 针对ID为1的权限分组,设置全选权限,查看返回的数据元素数量
r(count($group2->acl)) && p() && e('3'); // 针对ID为1的权限分组,设置任务创建权限,查看返回的数据元素数量
r($group2->acl) && p('task:create') && e('create'); // 针对ID为1的权限分组,设置任务创建权限,查看是否有创建方法
system("./ztest init");