* Finish task #36375.

This commit is contained in:
tianshujie98
2021-03-03 09:41:35 +08:00
parent f53deb3ca5
commit 0d11a4dca3
9 changed files with 91 additions and 19 deletions
-1
View File
@@ -1096,7 +1096,6 @@ class program extends control
$this->view->title = $this->lang->program->batchEdit;
$this->view->position[] = $this->lang->program->batchEdit;
$this->view->projectIdList = $projectIdList;
$this->view->projects = $projects;
$this->view->programList = $this->program->getParentPairs();
$this->view->PMUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst', $appendPMUsers);
+8 -1
View File
@@ -153,12 +153,19 @@ $lang->program->featureBar['suspended'] = 'Suspended';
$lang->program->featureBar['closed'] = 'Closed';
$lang->program->PRJAclList['private'] = 'Private (For team members and stakeholders only)';
$lang->program->PRJAclList['open'] = "Open(accessible with project view permissions)";
$lang->program->PRJAclList['open'] = "Open (accessible with project view permissions)";
$lang->program->PRJAcls['private'] = 'Private';
$lang->program->PRJAcls['open'] = "Open";
$lang->program->PGMPRJAclList['private'] = "Private (For team members and stakeholders only)";
$lang->program->PGMPRJAclList['program'] = "Public within the project set (accessible to all higher-level project set leaders and stakeholders, members of this project team and stakeholders)";
$lang->program->PGMPRJAclList['open'] = "Full disclosure (accessible with project view permissions)";
$lang->program->PGMPRJAcls['private'] = "Private";
$lang->program->PGMPRJAcls['program'] = "Public within the project set";
$lang->program->PGMPRJAcls['open'] = "Full disclosure";
$lang->program->PRJAuthList['extend'] = 'Inherit (system privilege and project privilege)';
$lang->program->PRJAuthList['reset'] = 'Reset (project privilege only)';
+8 -1
View File
@@ -153,12 +153,19 @@ $lang->program->featureBar['suspended'] = 'Suspended';
$lang->program->featureBar['closed'] = 'Closed';
$lang->program->PRJAclList['private'] = 'Private (For team members and stakeholders only)';
$lang->program->PRJAclList['open'] = "Open(accessible with project view permissions)";
$lang->program->PRJAclList['open'] = "Open (accessible with project view permissions)";
$lang->program->PRJAcls['private'] = 'Private';
$lang->program->PRJAcls['open'] = "Open";
$lang->program->PGMPRJAclList['private'] = "Private (For team members and stakeholders only)";
$lang->program->PGMPRJAclList['program'] = "Public within the project set (accessible to all higher-level project set leaders and stakeholders, members of this project team and stakeholders)";
$lang->program->PGMPRJAclList['open'] = "Full disclosure (accessible with project view permissions)";
$lang->program->PGMPRJAcls['private'] = "Private";
$lang->program->PGMPRJAcls['program'] = "Public within the project set";
$lang->program->PGMPRJAcls['open'] = "Full disclosure";
$lang->program->PRJAuthList['extend'] = 'Inherit (system privilege and project privilege)';
$lang->program->PRJAuthList['reset'] = 'Reset (project privilege only)';
+8 -1
View File
@@ -153,12 +153,19 @@ $lang->program->featureBar['suspended'] = 'Suspended';
$lang->program->featureBar['closed'] = 'Closed';
$lang->program->PRJAclList['private'] = 'Private (For team members and stakeholders only)';
$lang->program->PRJAclList['open'] = "Open(accessible with project view permissions)";
$lang->program->PRJAclList['open'] = "Open (accessible with project view permissions)";
$lang->program->PRJAcls['private'] = 'Private';
$lang->program->PRJAcls['open'] = "Open";
$lang->program->PGMPRJAclList['private'] = "Private (For team members and stakeholders only)";
$lang->program->PGMPRJAclList['program'] = "Public within the project set (accessible to all higher-level project set leaders and stakeholders, members of this project team and stakeholders)";
$lang->program->PGMPRJAclList['open'] = "Full disclosure (accessible with project view permissions)";
$lang->program->PGMPRJAcls['private'] = "Private";
$lang->program->PGMPRJAcls['program'] = "Public within the project set";
$lang->program->PGMPRJAcls['open'] = "Full disclosure";
$lang->program->PRJAuthList['extend'] = 'Inherit (system privilege and project privilege)';
$lang->program->PRJAuthList['reset'] = 'Reset (project privilege only)';
+8 -1
View File
@@ -153,12 +153,19 @@ $lang->program->featureBar['suspended'] = 'Suspended';
$lang->program->featureBar['closed'] = 'Closed';
$lang->program->PRJAclList['private'] = 'Private (For team members and stakeholders only)';
$lang->program->PRJAclList['open'] = "Open(accessible with project view permissions)";
$lang->program->PRJAclList['open'] = "Open (accessible with project view permissions)";
$lang->program->PRJAcls['private'] = 'Private';
$lang->program->PRJAcls['open'] = "Open";
$lang->program->PGMPRJAclList['private'] = "Private (For team members and stakeholders only)";
$lang->program->PGMPRJAclList['program'] = "Public within the project set (accessible to all higher-level project set leaders and stakeholders, members of this project team and stakeholders)";
$lang->program->PGMPRJAclList['open'] = "Full disclosure (accessible with project view permissions)";
$lang->program->PGMPRJAcls['private'] = "Private";
$lang->program->PGMPRJAcls['program'] = "Public within the project set";
$lang->program->PGMPRJAcls['open'] = "Full disclosure";
$lang->program->PRJAuthList['extend'] = 'Inherit (system privilege and project privilege)';
$lang->program->PRJAuthList['reset'] = 'Reset (project privilege only)';
+7
View File
@@ -155,10 +155,17 @@ $lang->program->featureBar['closed'] = '已关闭';
$lang->program->PRJAclList['private'] = "私有(只有项目团队成员和干系人可访问)";
$lang->program->PRJAclList['open'] = "公开(有项目视图权限即可访问)";
$lang->program->PRJAcls['private'] = "私有";
$lang->program->PRJAcls['open'] = "公开";
$lang->program->PGMPRJAclList['private'] = "私有(只有项目团队成员和干系人可访问)";
$lang->program->PGMPRJAclList['program'] = "项目集内公开(所有上级项目集负责人和干系人,本项目团队成员和干系人可访问)";
$lang->program->PGMPRJAclList['open'] = "全部公开(有项目视图权限即可访问)";
$lang->program->PGMPRJAcls['private'] = "私有";
$lang->program->PGMPRJAcls['program'] = "项目集内公开";
$lang->program->PGMPRJAcls['open'] = "全部公开";
$lang->program->PRJAuthList['extend'] = '继承(取系统权限与项目权限的合集)';
$lang->program->PRJAuthList['reset'] = '重新定义(只取项目权限)';
+29 -7
View File
@@ -1707,7 +1707,6 @@ class programModel extends model
}
}
/* Judge products not empty. */
$linkedProductsCount = 0;
foreach($_POST['products'] as $product)
@@ -1775,28 +1774,48 @@ class programModel extends model
foreach($data->projectIdList as $projectID)
{
$projectName = $data->names[$projectID];
$parentProgram = $data->parents[$projectID];
$projectID = (int)$projectID;
$projects[$projectID] = new stdClass();
$projects[$projectID]->name = $projectName;
$projects[$projectID]->parent = $parentProgram;
$projects[$projectID]->parent = $data->parents[$projectID];
$projects[$projectID]->PM = $data->PMs[$projectID];
$projects[$projectID]->begin = $data->begins[$projectID];
$projects[$projectID]->end = isset($data->ends[$projectID]) ? $data->ends[$projectID] : LONG_TIME;
$projects[$projectID]->days = $data->dayses[$projectID];
$projects[$projectID]->acl = $data->acls[$projectID];
$projects[$projectID]->lastEditedBy = $this->app->user->account;
$projects[$projectID]->lastEditedDate = helper::now();
/* Check unique name for edited projects. */
if(isset($nameList[$projectName])) dao::$errors['name'][] = 'project#' . $projectID . sprintf($this->lang->error->unique, $this->lang->program->PRJName, $projectName);
if(isset($nameList[$projectName])) dao::$errors['name'][] = 'project#' . $projectID . sprintf($this->lang->error->unique, $this->lang->program->PRJName, $projectName);
$nameList[$projectName] = $projectName;
if($projects[$projectID]->parent)
{
$parentProgram = $this->dao->select('*')->from(TABLE_PROGRAM)->where('id')->eq($projects[$projectID]->parent)->fetch();
if($parentProgram)
{
/* Child project begin cannot less than parent. */
if($projects[$projectID]->begin < $parentProgram->begin) dao::$errors['begin'] = sprintf($this->lang->program->PRJBeginGreateChild, $parentProgram->begin);
/* When parent set end then child project end cannot greater than parent. */
if($parentProgram->end != '0000-00-00' and $projects[$projectID]->end > $parentProgram->end) dao::$errors['end'] = sprintf($this->lang->program->PRJEndLetterChild, $parentProgram->end);
}
}
}
foreach($projects as $projectID => $project)
{
$oldProject = $oldProjects[$projectID];
$this->dao->update(TABLE_PROJECT)
->data($project)
->autoCheck()
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck($skipFields = 'begin,end')
->batchCheck($this->config->program->PRJEdit->requiredFields , 'notempty')
->checkIF($project->begin != '', 'begin', 'date')
->checkIF($project->end != '', 'end', 'date')
->checkIF($project->end != '', 'end', 'gt', $project->begin)
->check('name', 'unique', "id NOT " . helper::dbIN($data->projectIdList) . " and deleted='0'")
->where('id')->eq($projectID)
->exec();
@@ -1808,6 +1827,9 @@ class programModel extends model
$this->updateProductPGM($oldProject->parent, $project->parent, $linkedProducts);
if($oldProject->parent != $project->parent) $this->processNode($projectID, $project->parent, $oldProject->path, $oldProject->grade);
/* When acl is open, white list set empty. When acl is private,update user view. */
if($project->acl == 'open') $this->loadModel('personnel')->updateWhitelist('', 'project', $projectID);
if($project->acl != 'open') $this->loadModel('user')->updateUserView($projectID, 'project');
}
$allChanges[$projectID] = common::createChanges($oldProject, $project);
}
+23 -6
View File
@@ -11,6 +11,7 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('weekend', $config->project->weekend);?>
<?php js::set('linkedProjectsTip', $lang->program->linkedProjectsTip);?>
<?php js::set('changeProgram', $lang->program->changeProgram);?>
<?php $requiredFields = $config->program->PRJEdit->requiredFields;?>
@@ -22,19 +23,35 @@
<table class="table table-form">
<thead>
<tr>
<th class='w-40px'> <?php echo $lang->idAB;?></th>
<th class='w-200px'> <?php echo $lang->program->PGMParent;?></th>
<th class='w-40px'><?php echo $lang->idAB;?></th>
<th class='w-200px'><?php echo $lang->program->PGMParent;?></th>
<th class='c-name required'><?php echo $lang->program->PRJName;?></th>
<th class="w-150px <?php echo strpos($requiredFields, 'PM') !== false ? 'required' : '';?>"> <?php echo $lang->program->PRJPM;?></th>
<th class='w-120px required'><?php echo $lang->program->begin;?></th>
<th class='w-120px required'><?php echo $lang->program->end;?></th>
<th class='w-250px'><?php echo $lang->project->acl;?></th>
</tr>
</thead>
<tbody>
<?php foreach($projectIdList as $projectID):?>
<?php foreach($projects as $projectID => $project):?>
<?php $aclList = $project->parent ? $lang->program->PGMPRJAcls : $lang->program->PRJAcls;?>
<tr>
<td><?php echo sprintf('%03d', $projectID) . html::hidden("projectIdList[$projectID]", $projectID);?></td>
<td><?php echo html::select("parents[$projectID]", $programList, $projects[$projectID]->parent, "class='form-control chosen' data-id='$projectID' data-name='{$projects[$projectID]->name}' data-parent='{$projects[$projectID]->parent}'");?></td>
<td title='<?php echo $projects[$projectID]->name;?>'><?php echo html::input("names[$projectID]", $projects[$projectID]->name, "class='form-control'");?></td>
<td><?php echo html::select("PMs[$projectID]", $PMUsers, $projects[$projectID]->PM, "class='form-control chosen'");?></td>
<td><?php echo html::select("parents[$projectID]", $programList, $project->parent, "class='form-control chosen' data-id='$projectID' data-name='{$project->name}' data-parent='{$project->parent}'");?></td>
<td title='<?php echo $project->name;?>'><?php echo html::input("names[$projectID]", $project->name, "class='form-control'");?></td>
<td><?php echo html::select("PMs[$projectID]", $PMUsers, $project->PM, "class='form-control chosen'");?></td>
<td>
<?php echo html::input("begins[$projectID]", $project->begin, "class='form-control form-date' onchange='computeWorkDays(this.id);' placeholder='" . $lang->program->begin . "'");?>
</td>
<td>
<?php
$disabledEnd = $project->end == LONG_TIME ? 'disabled' : '';
$end = $project->end == LONG_TIME ? $lang->program->PRJLongTime : $project->end;
echo html::input("ends[$projectID]", $end, "class='form-control form-date' $disabledEnd onchange='computeWorkDays(this.id);' placeholder='" . $lang->program->end . "'");
echo html::hidden("dayses[$projectID]", $project->days);
?>
</td>
<td><?php echo nl2br(html::radio("acls[$projectID]", $aclList, $project->acl));?></td>
</tr>
<?php endforeach;?>
</tbody>