Merge branch 'sprint/176_xieqiyu_45536' into 'master'

Sprint/176 xieqiyu 45536

See merge request easycorp/zentaopms!884
This commit is contained in:
朱金勇
2021-12-10 06:15:15 +00:00
22 changed files with 148 additions and 28 deletions
+1 -1
View File
@@ -216,7 +216,7 @@ class company extends control
$this->view->products = $products;
/* Get projects' list.*/
$projects = $this->loadModel('project')->getPairsByProgram(0);
$projects = $this->loadModel('project')->getPairsByProgram();
$this->view->projects = array($this->lang->company->project) + $projects;;
/* Get executions' list.*/
+1 -1
View File
@@ -2026,7 +2026,7 @@ class execution extends control
public function executionKanban()
{
$this->loadModel('project');
$projects = $this->project->getPairsByProgram(0, 'noclosed');
$projects = $this->project->getPairsByProgram('', 'noclosed');
$executions = $this->project->getStats(0, 'all', 0, 0, 30, 'id_desc');
$teams = $this->dao->select('root,account')->from(TABLE_TEAM)
+1 -1
View File
@@ -142,7 +142,7 @@ class group extends control
$this->view->group = $group;
$this->view->programs = $this->loadModel('program')->getPairs(true, 'order_desc');
$this->view->projects = $this->loadModel('project')->getPairsByProgram(0, 'all', true, 'order_desc');
$this->view->projects = $this->loadModel('project')->getPairsByProgram('', 'all', true, 'order_desc');
$this->view->executions = $this->loadModel('execution')->getPairs(0, 'all', 'all');
$this->view->products = $this->loadModel('product')->getPairs();
+1 -1
View File
@@ -720,7 +720,7 @@ class my extends control
$this->view->pager = $pager;
$this->view->ncs = $this->my->getNcList($browseType, $orderBy, $pager);
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
$this->view->projects = $this->loadModel('project')->getPairsByProgram(0);
$this->view->projects = $this->loadModel('project')->getPairsByProgram();
$this->view->mode = 'nc';
$this->display();
}
+7 -1
View File
@@ -80,7 +80,7 @@ class product extends control
public function project($status = 'all', $productID = 0, $branch = '', $involved = 0, $orderBy = 'order_desc')
{
$this->app->loadLang('execution');
$this->app->loadLang('project');
$this->loadModel('project');
$branch = ($this->cookie->preBranch !== '' and $branch === '') ? $this->cookie->preBranch : $branch;
setcookie('preBranch', $branch, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true);
@@ -90,10 +90,13 @@ class product extends control
/* Get PM id list. */
$accounts = array();
$projectStats = $this->product->getProjectStatsByProduct($productID, $status, $branch, $involved, $orderBy);
$product = $this->product->getByID($productID);
$projects = $this->project->getPairsByProgram($product->program, 'all', false, 'order_asc');
foreach($projectStats as $project)
{
if(!empty($project->PM) and !in_array($project->PM, $accounts)) $accounts[] = $project->PM;
unset($projects[$project->id]);
}
$PMList = $this->user->getListByAccounts($accounts, 'account');
@@ -103,8 +106,11 @@ class product extends control
$this->view->projectStats = $projectStats;
$this->view->PMList = $PMList;
$this->view->productID = $productID;
$this->view->product = $product;
$this->view->projects = $projects;
$this->view->status = $status;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->branchID = $branch;
$this->display();
}
+32
View File
@@ -6,5 +6,37 @@ $(function()
$.cookie('involved', involved, {expires:config.cookieLife, path:config.webRoot});
window.location.reload();
});
$('#saveButton').on('click', function()
{
var selectProjectID = $('#project').val();
var currentProductID = $('#product').val();
var currentBranchID = $('#branch').val();
$.get(createLink('project', 'ajaxGetLinkedProducts', 'projectID=' + selectProjectID), function(product)
{
var products = [];
var branches = [];
var linkedProducts = JSON.parse(product);
for(var productID in linkedProducts)
{
for(var branchID in linkedProducts[productID])
{
products.push(productID);
branches.push(branchID);
}
}
products.push(currentProductID);
branches.push(currentBranchID);
$.post(createLink('project', 'manageProducts', 'projectID=' + selectProjectID), {'products' : products, 'branch' : branches}, function()
{
$('#link2Project').modal('hide');
window.location.reload();
});
});
});
});
+5 -4
View File
@@ -33,10 +33,11 @@ $lang->product->changeProgram = "{$lang->productCommon} confirmation of the sc
$lang->product->addWhitelist = 'Add Whitelist';
$lang->product->unbindWhitelist = 'Unbind Whitelist';
$lang->product->indexAction = "All {$lang->productCommon}";
$lang->product->closeAction = "Close {$lang->productCommon}";
$lang->product->orderAction = "Sort {$lang->productCommon}";
$lang->product->exportAction = "Export {$lang->productCommon}";
$lang->product->indexAction = "All {$lang->productCommon}";
$lang->product->closeAction = "Close {$lang->productCommon}";
$lang->product->orderAction = "Sort {$lang->productCommon}";
$lang->product->exportAction = "Export {$lang->productCommon}";
$lang->product->link2Project = "Link Project";
$lang->product->basicInfo = 'Basic Info';
$lang->product->otherInfo = 'Other Info';
+5 -4
View File
@@ -33,10 +33,11 @@ $lang->product->changeProgram = "{$lang->productCommon}调整所属项目集
$lang->product->addWhitelist = '添加白名单';
$lang->product->unbindWhitelist = '移除白名单';
$lang->product->indexAction = "所有{$lang->productCommon}仪表盘";
$lang->product->closeAction = "关闭{$lang->productCommon}";
$lang->product->orderAction = "{$lang->productCommon}排序";
$lang->product->exportAction = "导出{$lang->productCommon}";
$lang->product->indexAction = "所有{$lang->productCommon}仪表盘";
$lang->product->closeAction = "关闭{$lang->productCommon}";
$lang->product->orderAction = "{$lang->productCommon}排序";
$lang->product->exportAction = "导出{$lang->productCommon}";
$lang->product->link2Project = "关联项目";
$lang->product->basicInfo = '基本信息';
$lang->product->otherInfo = '其他信息';
+5 -4
View File
@@ -33,10 +33,11 @@ $lang->product->changeProgram = "{$lang->productCommon}調整所屬項目集
$lang->product->addWhitelist = '添加白名單';
$lang->product->unbindWhitelist = '移除白名單';
$lang->product->indexAction = "所有{$lang->productCommon}儀表盤";
$lang->product->closeAction = "關閉{$lang->productCommon}";
$lang->product->orderAction = "{$lang->productCommon}排序";
$lang->product->exportAction = "導出{$lang->productCommon}";
$lang->product->indexAction = "所有{$lang->productCommon}儀表盤";
$lang->product->closeAction = "關閉{$lang->productCommon}";
$lang->product->orderAction = "{$lang->productCommon}排序";
$lang->product->exportAction = "導出{$lang->productCommon}";
$lang->product->link2Project = "關聯項目";
$lang->product->basicInfo = '基本信息';
$lang->product->otherInfo = '其他信息';
+31
View File
@@ -18,6 +18,12 @@
<?php echo html::checkbox('involved', array('1' => $lang->project->mine), '', $this->cookie->involved ? 'checked=checked' : '');?>
<div class="tip"><icon class='icon icon-help' data-toggle='popover' data-trigger='focus hover' data-placement='right' data-tip-class='text-muted popover-sm' data-content=<?php echo $lang->product->projectInfo;?>></icon></div>
</div>
<?php if($config->systemMode == 'new'):?>
<div class="btn-toolbar pull-right">
<?php if(common::hasPriv('project', 'manageProducts')) echo html::a('#link2Project', '<i class="icon-link"></i> ' . $lang->product->link2Project, '', "data-toggle='modal' class='btn btn-secondary'");?>
<?php if(common::hasPriv('project', 'create')) common::printLink('project', 'createGuide', "programID=$product->program", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-primary" data-toggle="modal" data-target="#guideDialog"');?>
</div>
<?php endif;?>
</div>
<div id="mainContent">
<?php if(empty($projectStats)):?>
@@ -97,4 +103,29 @@
<?php endif;?>
</div>
<script>$('[data-toggle="popover"]').popover();</script>
<div class="modal fade" id="link2Project">
<div class="modal-dialog mw-500px">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"><?php echo $lang->product->link2Project;?></h4>
</div>
<div class="modal-body">
<table class='table table-form'>
<tr>
<th><?php echo $lang->product->link2Project?></th>
<td><?php echo html::select('project', $projects, '', "class='form-control chosen'");?></td>
</tr>
<tr>
<td colspan='2' class='text-center'>
<?php echo html::hidden('product', $productID);?>
<?php echo html::hidden('branch', $branchID);?>
<?php echo html::commonButton($lang->save, "id='saveButton'", 'btn btn-primary btn-wide');?>
<?php echo html::commonButton($lang->cancel, "data-dismiss='modal'", 'btn btn-default btn-wide');?>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
+1 -1
View File
@@ -374,7 +374,7 @@ class productplan extends control
public function ajaxGetProjects($productID, $branch = 0)
{
$projects = $this->loadModel('product')->getProjectPairsByProduct($productID, $branch);
die(html::select('project', $projects, '', "class='form-control chosen'"));
die(html::select('project', $projects, key($projects), "class='form-control chosen'"));
}
/**
+12
View File
@@ -76,5 +76,17 @@ function getPlanID(obj, branch)
$('#project').replaceWith(projects);
$("#project_chosen").remove();
$("#project").chosen();
var projectList = $("#project").val();
if(!projectList)
{
$("#project").attr('disabled', true);
$("#project").trigger('chosen:updated');
$(".tips").removeClass('hidden');
var locateLink = createLink('product', 'project', 'status=all&productID=' + productID);
var locateButton = "<a href=" + locateLink + " class='btn btn-primary' data-app='product'>" + enterProjectList + "</a>";
$("#projects .btn-primary").replaceWith(locateButton);
}
});
}
+2
View File
@@ -86,6 +86,8 @@ $lang->productplan->errorNoEnd = 'ID %s end time should not be empty.';
$lang->productplan->beginGeEnd = 'ID %s begin time should not be >= end time.';
$lang->productplan->beginLetterParent = "The start date of the parent plan: %s, the start date cannot be less than the start date of the parent plan.";
$lang->productplan->endGreaterParent = "The completion date of the parent plan: %s, the completion date cannot be greater than the completion date of the parent plan.";
$lang->productplan->noLinkedProject = "The current product has not been linked with a project. Please enter the list of the product to link or create a project.";
$lang->productplan->enterProjectList = "Enter the list of the product";
$lang->productplan->featureBar['browse']['all'] = 'All';
$lang->productplan->featureBar['browse']['unexpired'] = 'Unexpired';
+2
View File
@@ -86,6 +86,8 @@ $lang->productplan->errorNoEnd = 'ID %s 结束时间不能为空';
$lang->productplan->beginGeEnd = 'ID %s 开始时间不能大于结束时间';
$lang->productplan->beginLetterParent = "父计划的开始日期:%s,开始日期不能小于父计划的开始日期";
$lang->productplan->endGreaterParent = "父计划的完成日期:%s,完成日期不能大于父计划的完成日期";
$lang->productplan->noLinkedProject = "当前产品还未关联项目,请进入产品的项目列表关联或创建一个项目";
$lang->productplan->enterProjectList = "进入产品的项目列表";
$lang->productplan->featureBar['browse']['all'] = '全部';
$lang->productplan->featureBar['browse']['unexpired'] = '未过期';
+6
View File
@@ -14,6 +14,8 @@
<?php js::set('confirmDelete', $lang->productplan->confirmDelete)?>
<?php js::set('browseType', $browseType);?>
<?php js::set('productID', $productID);?>
<?php js::set('noLinkedProject', $lang->productplan->noLinkedProject);?>
<?php js::set('enterProjectList', $lang->productplan->enterProjectList);?>
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left">
<?php foreach(customModel::getFeatureMenu($this->moduleName, $this->methodName) as $menuItem):?>
@@ -191,6 +193,10 @@
<th><?php echo $lang->productplan->project?></th>
<td><?php echo html::select('project', $projects, '', "class='form-control chosen'");?></td>
</tr>
<tr class='tips hidden'>
<th></th>
<td><span class='text-red'><?php echo $lang->productplan->noLinkedProject;?></span></td>
</tr>
<tr>
<td colspan='2' class='text-center'>
<?php echo html::hidden('planID', '');?>
+1 -1
View File
@@ -29,7 +29,7 @@
<?php if(common::hasPriv('project', 'batchEdit') and $programType != 'bygrid') echo html::checkbox('editProject', array('1' => $lang->project->edit), '', $this->cookie->editProject ? 'checked=checked' : '');?>
</div>
<div class='pull-right'>
<?php common::printLink('project', 'createGuide', "programID=0&from=PGM", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-secondary" data-toggle="modal" data-target="#guideDialog"');?>
<?php if(common::hasPriv('project', 'create')) common::printLink('project', 'createGuide', "programID=0&from=PGM", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-secondary" data-toggle="modal" data-target="#guideDialog"');?>
<?php if(isset($lang->pageActions)) echo $lang->pageActions;?>
</div>
</div>
+1 -1
View File
@@ -30,7 +30,7 @@ js::set('browseType', $browseType);
<?php echo html::checkbox('involved ', array('1' => $lang->project->mine), '', $this->cookie->involved ? 'checked=checked' : '');?>
</div>
<div class="btn-toolbar pull-right">
<?php common::printLink('project', 'createGuide', "programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-primary" data-toggle="modal" data-target="#guideDialog"');?>
<?php if(common::hasPriv('project', 'create')) common::printLink('project', 'createGuide', "programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-primary" data-toggle="modal" data-target="#guideDialog"');?>
</div>
</div>
<div id='mainContent' class="main-row fade">
+19
View File
@@ -214,6 +214,25 @@ class project extends control
die($this->lang->project->unlinkExecutionMember);
}
/**
* AJAX: Get linked products with branch.
*
* @param int $projectID
* @access public
* @return void
*/
public function ajaxGetLinkedProducts($projectID)
{
$productsWithBranch = array();
$linkedProducts = $this->project->getBranchesByProject($projectID);
foreach($linkedProducts as $productID => $branches)
{
foreach($branches as $branchID => $branchInfo) $productsWithBranch[$productID][$branchID] = $branchID;
}
echo json_encode($productsWithBranch);
}
/**
* Project index view.
*
+2 -2
View File
@@ -490,13 +490,13 @@ class projectModel extends model
* @access public
* @return object
*/
public function getPairsByProgram($programID = 0, $status = 'all', $isQueryAll = false, $orderBy = 'order_asc')
public function getPairsByProgram($programID = '', $status = 'all', $isQueryAll = false, $orderBy = 'order_asc')
{
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProjectPairs();
return $this->dao->select('id, name')->from(TABLE_PROJECT)
->where('type')->eq('project')
->andWhere('deleted')->eq(0)
->beginIF($programID)->andWhere('parent')->eq($programID)->fi()
->beginIF($programID !== '')->andWhere('parent')->eq($programID)->fi()
->beginIF($status != 'all' && $status != 'noclosed')->andWhere('status')->eq($status)->fi()
->beginIF($status == 'noclosed')->andWhere('status')->ne('closed')->fi()
->beginIF(!$this->app->user->admin and !$isQueryAll)->andWhere('id')->in($this->app->user->view->projects)->fi()
+2 -2
View File
@@ -48,7 +48,7 @@
</div>
<?php common::printLink('project', 'export', "status=$browseType&orderBy=$orderBy", "<i class='icon-export muted'> </i>" . $lang->export, '', "class='btn btn-link export'")?>
<?php if(!defined('TUTORIAL')):?>
<?php common::printLink('project', 'createGuide', "programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-primary create-project-btn" data-toggle="modal"');?>
<?php if(common::hasPriv('project', 'create')) common::printLink('project', 'createGuide', "programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-primary create-project-btn" data-toggle="modal"');?>
<?php else:?>
<?php common::printLink('project', 'create', "mode=scrum&programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-primary create-project-btn"');?>
<?php endif;?>
@@ -72,7 +72,7 @@
<p>
<span class="text-muted"><?php echo $lang->project->empty;?></span>
<?php if(!defined('TUTORIAL')):?>
<?php common::printLink('project', 'createGuide', "programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-info" data-toggle="modal"');?>
<?php if(common::hasPriv('project', 'create')) common::printLink('project', 'createGuide', "programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-info" data-toggle="modal"');?>
<?php elseif($this->config->systemMode == 'new'):?>
<?php common::printLink('project', 'create', "mode=scrum&programID=$programID", '<i class="icon icon-plus"></i> ' . $lang->project->create, '', 'class="btn btn-info"');?>
<?php else:?>
+9 -2
View File
@@ -17,14 +17,14 @@
<div class='row'>
<div class='col-xs-6'>
<div class='project-type text-center'>
<?php echo html::a($this->createLink("project", "create", "model=scrum&projectID=$projectID"), "<img class='project-type-img' data-type='scrum' src='{$config->webRoot}theme/default/images/main/scrum.png'>", '', "data-app='project'")?>
<?php echo html::a($this->createLink("project", "create", "model=scrum&projectID=$projectID"), "<img class='project-type-img' data-type='scrum' src='{$config->webRoot}theme/default/images/main/scrum.png'>", '', "data-app='project' class='createButton'")?>
<h3><?php echo $lang->project->scrum; ?></h3>
<p><?php echo $lang->project->scrumTitle; ?></p>
</div>
</div>
<div class='col-xs-6'>
<div class='project-type text-center'>
<?php echo html::a($this->createLink("project", "create", "model=waterfall&projectID=$projectID"), "<img class='project-type-img' data-type='waterfall' src='{$config->webRoot}theme/default/images/main/waterfall.png'>", '', "data-app='project'")?>
<?php echo html::a($this->createLink("project", "create", "model=waterfall&projectID=$projectID"), "<img class='project-type-img' data-type='waterfall' src='{$config->webRoot}theme/default/images/main/waterfall.png'>", '', "data-app='project' class='createButton'")?>
<h3><?php echo $lang->project->waterfall; ?></h3>
<p><?php echo $lang->project->waterfallTitle; ?></p>
</div>
@@ -33,3 +33,10 @@
</div>
</div>
</div>
<script>
$('.createButton').on('click', function()
{
$('#guideDialog').modal('hide');
window.location.reload();
});
</script>
+2 -2
View File
@@ -432,7 +432,7 @@ class task extends control
$tasks = $this->task->getParentTaskPairs($this->view->execution->id, $this->view->task->parent);
if(isset($tasks[$taskID])) unset($tasks[$taskID]);
if($this->config->systemMode == 'classic')
if($this->config->systemMode == 'classic')
{
$executionsPair = $this->execution->getPairs();
}
@@ -440,7 +440,7 @@ class task extends control
{
$executionsPair = array();
$executions = $this->execution->getByProject(0, 'all', 0);
$projects = $this->project->getPairsByProgram(0, 'noclosed');
$projects = $this->project->getPairsByProgram('', 'noclosed');
foreach($executions as $executionId => $execution)
{
$executionsPair[$executionId] = (isset($projects[$execution->project]) ? $projects[$execution->project] . ' / ' : '') . $execution->name;