Merge branch 'group_zg_unit' into 'zentaopms_195'

Group unit

See merge request easycorp/zentaopms!3647
This commit is contained in:
孙广明
2022-05-29 06:02:36 +00:00
8 changed files with 75 additions and 15 deletions
+2 -1
View File
@@ -2,6 +2,7 @@
#projectList .c-actions {overflow: visible;}
#projectTableList > tr:last-child .c-actions .dropdown-menu {top: auto; bottom: 100%; margin-bottom: -5px;}
.c-budget {width: 100px;}
.c-date {width: 80px;}
.c-budget {width: 80px;}
.label-warning, .label-info {width: 60px !important;}
.project-type-label.label-outline {width: 50px; min-width: 50px;}
+1
View File
@@ -1 +1,2 @@
.c-begin {width: 120px;}
.c-end {width: 100px;}
+1 -1
View File
@@ -40,7 +40,7 @@
<th class='c-status'><?php common::printOrderLink('status', $orderBy, $vars, $lang->project->status);?></th>
<?php endif;?>
<th class='c-date c-begin'><?php common::printOrderLink('begin', $orderBy, $vars, $lang->project->begin);?></th>
<th class='c-date'><?php common::printOrderLink('end', $orderBy, $vars, $lang->project->end);?></th>
<th class='c-date c-end'><?php common::printOrderLink('end', $orderBy, $vars, $lang->project->end);?></th>
<th class='text-right c-budget'><?php common::printOrderLink('budget', $orderBy, $vars, $lang->project->budget);?></th>
<th class='c-user'><?php common::printOrderLink('PM', $orderBy, $vars, $lang->project->PM);?></th>
<th class='text-center c-actions-6'><?php echo $lang->actions;?></th>
+40 -6
View File
@@ -56,13 +56,20 @@ class groupTest
* @access public
* @return void
*/
public function copyTest($groupID)
public function copyTest($groupID, $param)
{
foreach($param as $k => $v) $_POST[$k] = $v;
$objects = $this->objectModel->copy($groupID);
unset($_POST);
if(dao::isError()) return dao::getError();
return $objects;
$newGroupID = $this->objectModel->dao->lastInsertID();
$object = $this->objectModel->getByID($newGroupID);
$this->objectModel->delete($newGroupID);
return $object;
}
/**
@@ -79,7 +86,22 @@ class groupTest
if(dao::isError()) return dao::getError();
return $objects;
$fromPrivs = $this->objectModel->getPrivs($fromGroup);
$toPrivs = $this->objectModel->getPrivs($toGroup);
$result = true;
foreach($fromPrivs as $group => $privs)
{
foreach($privs as $key => $priv)
{
if(!isset($toPrivs[$group][$key]) or $toPrivs[$group][$key] != $fromPrivs[$group][$key])
{
$result = false;
break;
}
}
}
return $result;
}
/**
@@ -96,7 +118,19 @@ class groupTest
if(dao::isError()) return dao::getError();
return $objects;
$fromUsers = $this->objectModel->getUserPairs($fromGroup);
$toUsers = $this->objectModel->getUserPairs($toGroup);
$result = true;
foreach($fromUsers as $account => $name)
{
if(!isset($toUsers[$account]) or $toUsers[$account] != $fromUsers[$account])
{
$result = false;
break;
}
}
return $result;
}
/**
@@ -268,11 +302,11 @@ class groupTest
*/
public function deleteTest($groupID, $null = null)
{
$objects = $this->objectModel->delete($groupID, $null = null);
$this->objectModel->delete($groupID, $null = null);
if(dao::isError()) return dao::getError();
return $objects;
return true;
}
/**
+10 -2
View File
@@ -10,8 +10,16 @@ title=测试 groupModel->copy();
cid=1
pid=1
复制id为2的分组 >> 这是一个复制的分组
复制名字已存在的分组 >> 『分组名称』已经有『我是一个分组』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。
*/
$group = new groupTest();
$groupID = 2;
r($group->copyTest()) && p() && e();
$data = array('name' => '这是一个复制的分组');
$existData = array('name' => '我是一个分组');
$group = new groupTest();
r($group->copyTest($groupID, $data)) && p('name') && e('这是一个复制的分组'); // 这是一个复制的分组
r($group->copyTest($groupID, $existData)) && p('name:0') && e('『分组名称』已经有『我是一个分组』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。'); // 『分组名称』已经有『我是一个分组』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。
+6 -2
View File
@@ -10,8 +10,12 @@ title=测试 groupModel->copyPriv();
cid=1
pid=1
复制分组6权限到分组7 >> 1
*/
$group = new groupTest();
$fromGroup = 6;
$toGroup = 7;
r($group->copyPrivTest()) && p() && e();
$group = new groupTest();
r($group->copyPrivTest($fromGroup, $toGroup)) && p() && e('1'); // 复制分组6权限到分组7
+7 -1
View File
@@ -10,8 +10,14 @@ title=测试 groupModel->copyUser();
cid=1
pid=1
复制分组6用户到分组7 >> 1
*/
$fromGroup = 6;
$toGroup = 7;
$group = new groupTest();
r($group->copyUserTest()) && p() && e();
r($group->copyUserTest($fromGroup, $toGroup)) && p() && e('1'); // 复制分组6用户到分组7
system("./ztest init");
+8 -2
View File
@@ -10,8 +10,14 @@ title=测试 groupModel->delete();
cid=1
pid=1
删除id为10的组 >> 1
删除id为0的组 >> 1
*/
$group = new groupTest();
$groupID = 10;
r($group->deleteTest()) && p() && e();
$group = new groupTest();
r($group->deleteTest($groupID)) && p() && e('1'); // 删除id为10的组
r($group->deleteTest(0)) && p() && e('1'); // 删除id为0的组
system("./ztest init");