Merge branch 'sprint/290_liumengyi_32244' into 'master'

* Fix bug #32244, #32245, #32249, #32251,  #32255, #32179, @32167.

See merge request easycorp/zentaopms!6989
This commit is contained in:
王怡栋
2023-02-20 01:16:52 +00:00
12 changed files with 45 additions and 41 deletions
+1 -1
View File
@@ -376,7 +376,7 @@ class action extends control
/* Check type of siblings. */
$siblings = $this->dao->select('DISTINCT type')->from(TABLE_EXECUTION)->where('deleted')->eq(0)->andWhere('parent')->eq($execution->parent)->fetchPairs('type');
if($execution->type == 'stage' and (isset($bsiblings['sprint']) or isset($siblings['kanban']))) die(js::alert($this->lang->action->hasOtherType[$execution->type]));
if($execution->type == 'stage' and (isset($siblings['sprint']) or isset($siblings['kanban']))) die(js::alert($this->lang->action->hasOtherType[$execution->type]));
if(($execution->type == 'sprint' or $execution->type == 'kanban') and isset($siblings['stage'])) die(js::alert($this->lang->action->hasOtherType[$execution->type]));
/* If parent stage is not exists, you should recover its parent stages, refresh status. */
+1 -1
View File
@@ -489,7 +489,7 @@ class actionModel extends model
elseif($actionName == 'importedcard')
{
$title = $this->dao->select('name')->from(TABLE_KANBAN)->where('id')->eq($action->extra)->fetch('name');
if($title) $action->extra = common::hasPriv('kanban', 'view') ? html::a(helper::createLink('kanban', 'view', "kanbanID=$action->extra"), "#$action->extra " . $title) : "#$action->extra " . $title;
if($title) $action->extra = (common::hasPriv('kanban', 'view') and !isonlybody()) ? html::a(helper::createLink('kanban', 'view', "kanbanID=$action->extra"), "#$action->extra " . $title) : "#$action->extra " . $title;
}
elseif($actionName == 'createchildren')
{
+1 -1
View File
@@ -1900,7 +1900,7 @@ class execution extends control
$this->view->users = $this->loadModel('user')->getPairs('nodeleted|noclosed');
$this->view->copyExecution = isset($copyExecution) ? $copyExecution : '';
$this->view->from = $this->app->tab;
$this->view->isStage = (isset($project->model) and $project->model == 'waterfall') ? true : false;
$this->view->isStage = (isset($project->model) and ($project->model == 'waterfall' or $project->model == 'waterfallplus')) ? true : false;
$this->view->project = $project;
$this->view->division = !empty($project) ? $project->division : 1;
$this->view->type = $type;
+1 -1
View File
@@ -180,7 +180,7 @@ function loadBranches(product)
var branch = $('#branch' + index);
loadPlans(product, branch);
if(typeof isWaterfall != 'undefined' && isWaterfall == true)
if(typeof isStage != 'undefined' && isStage == true)
{
$tableRow.find("select[name^='branch'] option").attr('selected', 'selected');
$tableRow.find("select[name^='branch']").trigger('chosen:updated');
+4 -6
View File
@@ -31,7 +31,6 @@
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php $isWaterfall = (!empty($project->model) and ($project->model == 'waterfall' or $project->model == 'waterfallplus')) ? true : false;?>
<?php js::import($jsRoot . 'misc/date.js');?>
<?php js::set('weekend', $config->execution->weekend);?>
<?php js::set('holders', $lang->execution->placeholder);?>
@@ -47,7 +46,6 @@
<?php js::set('cancelCopy', $lang->execution->cancelCopy);?>
<?php js::set('copyNoExecution', $lang->execution->copyNoExecution);?>
<?php js::set('model', isset($project->model) ? $project->model : '');?>
<?php js::set('isWaterfall', $isWaterfall);?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
@@ -153,9 +151,9 @@
<?php $hasBranch = $product->type != 'normal' and isset($branchGroups[$product->id]);?>
<div class='input-group <?php if($hasBranch) echo ' has-branch';?>'>
<span class='input-group-addon'><?php echo $lang->product->common;?></span>
<?php $disabled = ($isWaterfall and !$project->division) ? "disabled='disabled'" : '';?>
<?php $disabled = ($isStage and !$project->division) ? "disabled='disabled'" : '';?>
<?php echo html::select("products[$i]", $allProducts, $product->id, "class='form-control chosen' $disabled onchange='loadBranches(this)' data-last='" . $product->id . "' data-type='" . $product->type . "'");?>
<?php if($isWaterfall and !$project->division) echo html::hidden("products[$i]", $product->id);?>
<?php if($isStage and !$project->division) echo html::hidden("products[$i]", $product->id);?>
</div>
</div>
<div class='table-col <?php if(!$hasBranch) echo 'hidden'; if($disabled) echo ' disabledBranch'?>'>
@@ -171,7 +169,7 @@
<div class='input-group' <?php echo "id='plan$i'";?>>
<span class='input-group-addon'><?php echo $lang->product->plan;?></span>
<?php echo html::select("plans[$product->id][]", isset($productPlans[$product->id]) ? $productPlans[$product->id] : array(), isset($product->plans) ? $product->plans : '', "class='form-control chosen' multiple");?>
<?php if(!($isWaterfall and !$project->division)):?>
<?php if(!($isStage and !$project->division)):?>
<div class='input-group-btn'>
<a href='javascript:;' onclick='addNewLine(this)' class='btn btn-link addLine'><i class='icon-plus'></i></a>
<a href='javascript:;' onclick='removeLine(this)' class='btn btn-link removeLine' <?php if($i == 0) echo "style='visibility: hidden'";?>><i class='icon-close'></i></a>
@@ -219,7 +217,7 @@
<div class='input-group' id='plan0'>
<span class='input-group-addon'><?php echo $lang->product->plan;?></span>
<?php echo html::select("plans[][]", $productPlan, '', "class='form-control chosen' multiple");?>
<?php if(!($isWaterfall and $project->division)):?>
<?php if(!($isStage and $project->division)):?>
<div class='input-group-btn'>
<a href='javascript:;' onclick='addNewLine(this)' class='btn btn-link addLine'><i class='icon-plus'></i></a>
<a href='javascript:;' onclick='removeLine(this)' class='btn btn-link removeLine' style='visibility: hidden'><i class='icon-close'></i></a>
+2 -2
View File
@@ -82,7 +82,7 @@ $lang->programplan->delayList[0] = 'No';
$lang->programplan->typeList = array();
$lang->programplan->typeList['stage'] = 'Stage';
$lang->programplan->typeList['agileplus'] = 'Sprint/Kanban';
$lang->programplan->typeList['agileplus'] = $lang->executionCommon . '/Kanban';
$lang->programplan->noData = 'No Data';
$lang->programplan->children = 'Sub Plan';
@@ -118,7 +118,7 @@ $lang->programplan->error->sameName = 'Stage name cannot be the same!';
$lang->programplan->error->sameCode = 'Stage code cannot be the same!';
$lang->programplan->error->taskDrag = 'The %s task cannot be dragged';
$lang->programplan->error->planDrag = 'The %s stage cannot be dragged';
$lang->programplan->error->notStage = 'Sprint/Kanban cannot create a sub stage.';
$lang->programplan->error->notStage = $lang->executionCommon . '/Kanban cannot create a sub stage.';
$lang->programplan->ganttBrowseType['gantt'] = 'Group by Stage';
$lang->programplan->ganttBrowseType['assignedTo'] = 'Group by AssignedTo';
+2 -2
View File
@@ -82,7 +82,7 @@ $lang->programplan->delayList[0] = 'No';
$lang->programplan->typeList = array();
$lang->programplan->typeList['stage'] = 'Stage';
$lang->programplan->typeList['agileplus'] = 'Sprint/Kanban';
$lang->programplan->typeList['agileplus'] = $lang->executionCommon . '/Kanban';
$lang->programplan->noData = 'No Data';
$lang->programplan->children = 'Sub Plan';
@@ -118,7 +118,7 @@ $lang->programplan->error->sameName = 'Stage name cannot be the same!';
$lang->programplan->error->sameCode = 'Stage code cannot be the same!';
$lang->programplan->error->taskDrag = 'The %s task cannot be dragged';
$lang->programplan->error->planDrag = 'The %s stage cannot be dragged';
$lang->programplan->error->notStage = 'Sprint/Kanban cannot create a sub stage.';
$lang->programplan->error->notStage = $lang->executionCommon . '/Kanban cannot create a sub stage.';
$lang->programplan->ganttBrowseType['gantt'] = 'Group by Stage';
$lang->programplan->ganttBrowseType['assignedTo'] = 'Group by AssignedTo';
+2 -2
View File
@@ -82,7 +82,7 @@ $lang->programplan->delayList[0] = 'No';
$lang->programplan->typeList = array();
$lang->programplan->typeList['stage'] = 'Stage';
$lang->programplan->typeList['agileplus'] = 'Sprint/Kanban';
$lang->programplan->typeList['agileplus'] = $lang->executionCommon . '/Kanban';
$lang->programplan->noData = 'No Data';
$lang->programplan->children = 'Sub Plan';
@@ -118,7 +118,7 @@ $lang->programplan->error->sameName = 'Stage name cannot be the same!';
$lang->programplan->error->sameCode = 'Stage code cannot be the same!';
$lang->programplan->error->taskDrag = 'The %s task cannot be dragged';
$lang->programplan->error->planDrag = 'The %s stage cannot be dragged';
$lang->programplan->error->notStage = 'Sprint/Kanban cannot create a sub stage.';
$lang->programplan->error->notStage = $lang->executionCommon . '/Kanban cannot create a sub stage.';
$lang->programplan->ganttBrowseType['gantt'] = 'Group by Stage';
$lang->programplan->ganttBrowseType['assignedTo'] = 'Group by AssignedTo';
+2 -2
View File
@@ -82,7 +82,7 @@ $lang->programplan->delayList[0] = '否';
$lang->programplan->typeList = array();
$lang->programplan->typeList['stage'] = '阶段';
$lang->programplan->typeList['agileplus'] = '迭代/看板';
$lang->programplan->typeList['agileplus'] = $lang->executionCommon . '/看板';
$lang->programplan->noData = '暂无数据。';
$lang->programplan->children = '二级计划';
@@ -118,7 +118,7 @@ $lang->programplan->error->sameName = '阶段名称不能相同!';
$lang->programplan->error->sameCode = '阶段代号不能相同!';
$lang->programplan->error->taskDrag = '%s的任务不可以拖动';
$lang->programplan->error->planDrag = '%s的阶段不可以拖动';
$lang->programplan->error->notStage = '迭代/看板不支持创建子阶段';
$lang->programplan->error->notStage = $lang->executionCommon . '/看板不支持创建子阶段';
$lang->programplan->ganttBrowseType['gantt'] = '按阶段分组';
$lang->programplan->ganttBrowseType['assignedTo'] = '按指派给分组';
+23 -22
View File
@@ -749,7 +749,7 @@ class programplanModel extends model
foreach($datas as $index => $plan)
{
if(!empty($sameNames) and in_array($plan->name, $sameNames)) dao::$errors[$index]['name'] = empty($type) ? $this->lang->programplan->error->sameName : str_replace($this->lang->execution->stage, '', $this->lang->programplan->error->sameName);
if($setCode and $sameCodes !== true and !empty($sameCodes) and in_array($plan->code, $sameCodes)) dao::$errors[$index]['code'] = sprintf($this->lang->error->repeat, $this->lang->execution->code, $plan->code);
if($setCode and $sameCodes !== true and !empty($sameCodes) and in_array($plan->code, $sameCodes)) dao::$errors[$index]['code'] = sprintf($this->lang->error->repeat, $plan->type == 'stage' ? $this->lang->execution->code : $this->lang->code, $plan->code);
if($plan->percent and !preg_match("/^[0-9]+(.[0-9]{1,3})?$/", $plan->percent))
{
@@ -778,7 +778,7 @@ class programplanModel extends model
if(isset($parentStage) and ($plan->end > $parentStage->end || $plan->begin < $parentStage->begin))
{
if($plan->begin < $parentStage->begin and empty(dao::$errors[$index]['begin'])) dao::$errors[$index]['begin'] = $this->lang->programplan->error->parentDuration;
if($plan->end < $parentStage->end and empty(dao::$errors[$index]['end'])) dao::$errors[$index]['end'] = $this->lang->programplan->error->parentDuration;
if($plan->end > $parentStage->end and empty(dao::$errors[$index]['end'])) dao::$errors[$index]['end'] = $this->lang->programplan->error->parentDuration;
}
if($plan->begin < $project->begin and empty(dao::$errors[$index]['begin']))
{
@@ -793,7 +793,7 @@ class programplanModel extends model
if(helper::isZeroDate($plan->end)) $plan->end = '';
if($setCode and empty($plan->code))
{
dao::$errors[$index]['code'] = sprintf($this->lang->error->notempty, $this->lang->execution->code);
dao::$errors[$index]['code'] = sprintf($this->lang->error->notempty, $plan->type == 'stage' ? $this->lang->execution->code : $this->lang->code);
}
foreach(explode(',', $this->config->programplan->create->requiredFields) as $field)
{
@@ -833,6 +833,22 @@ class programplanModel extends model
}
}
$linkProducts = array();
$linkBranches = array();
$productList = $this->loadModel('product')->getProducts($projectID);
if($project->division)
{
$linkProducts = array(0 => $productID);
$linkBranches = array(0 => $productList[$productID]->branches);
}
else
{
$linkProducts = array_keys($productList);
foreach($linkProducts as $index => $productID) $linkBranches[$index] = $productList[$productID]->branches;
}
$this->post->set('products', $linkProducts);
$this->post->set('branch', $linkBranches);
foreach($datas as $data)
{
/* Set planDuration and realDuration. */
@@ -846,6 +862,7 @@ class programplanModel extends model
$data->days = helper::diffDate($data->end, $data->begin) + 1;
$data->order = current($orders);
if($data->id)
{
$stageID = $data->id;
@@ -985,22 +1002,6 @@ class programplanModel extends model
$this->computeProgress($stageID, 'create');
}
}
$linkProducts = array();
$linkBranches = array();
$productList = $this->loadModel('product')->getProducts($projectID);
if($project->division)
{
$linkProducts = array(0 => $productID);
$linkBranches = array(0 => $productList[$productID]->branches);
}
else
{
$linkProducts = array_keys($productList);
foreach($linkProducts as $index => $productID) $linkBranches[$index] = $productList[$productID]->branches;
}
$this->post->set('products', $linkProducts);
$this->post->set('branch', $linkBranches);
$this->execution->updateProducts($stageID);
/* If child plans has milestone, update parent plan set milestone eq 0 . */
@@ -1346,15 +1347,15 @@ class programplanModel extends model
public function checkCodeUnique($codes, $planIDList)
{
$codes = array_filter($codes);
if(count(array_unique($codes)) != count($codes)) return false;
$code = $this->dao->select('code')->from(TABLE_EXECUTION)
$sameCodes = $this->dao->select('code')->from(TABLE_EXECUTION)
->where('type')->in('sprint,stage,kanban')
->andWhere('deleted')->eq('0')
->andWhere('code')->in($codes)
->beginIF($planIDList)->andWhere('id')->notin($planIDList)->fi()
->fetchPairs('code');
return $code ? $code : true;
if(count(array_unique($codes)) != count($codes)) $sameCodes += array_diff_assoc($codes, array_unique($codes));
return $sameCodes ? $sameCodes : true;
}
/**
+1 -1
View File
@@ -1236,7 +1236,7 @@ class projectModel extends model
->setIF($this->post->delta == 999, 'days', 0)
->setIF($this->post->acl == 'open', 'whitelist', '')
->setIF(!isset($_POST['whitelist']), 'whitelist', '')
->setDefault('multiple', '1')
->setIF(!isset($_POST['multiple']), 'multiple', '1')
->setDefault('openedBy', $this->app->user->account)
->setDefault('openedDate', helper::now())
->setDefault('team', $this->post->name)
+5
View File
@@ -95,4 +95,9 @@ $(function()
{
$('#planIdBox .chosen-container').find('div').css('width', $('#planIdBox').width())
});
$('#parent_chosen').click(function()
{
$('#parent_chosen').find('div').css('width', $('#parent_chosen').width())
});
})