This commit is contained in:
wangyidong
2023-02-20 09:19:33 +08:00
16 changed files with 80 additions and 85 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')
{
+10 -40
View File
@@ -1727,15 +1727,8 @@ class execution extends control
}
$importPlanStoryTips = $multiBranchProduct ? $this->lang->execution->importBranchPlanStory : $this->lang->execution->importPlanStory;
if(!$execution->hasProduct)
{
return print(js::locate(inlink('create', "projectID=$projectID&executionID=$executionID")));
}
else
{
return print(js::confirm($importPlanStoryTips, inlink('create', "projectID=$projectID&executionID=$executionID&copyExecutionID=&planID=$planID&confirm=yes"), inlink('create', "projectID=$projectID&executionID=$executionID")));
}
return print(js::confirm($importPlanStoryTips, inlink('create', "projectID=$projectID&executionID=$executionID&copyExecutionID=&planID=$planID&confirm=yes"), inlink('create', "projectID=$projectID&executionID=$executionID")));
}
}
@@ -1801,16 +1794,11 @@ class execution extends control
{
if(isset($_POST['attribute']) and in_array($_POST['attribute'], array('request', 'design', 'review'))) unset($_POST['plans']);
/* No product execution link plans. */
if(isset($project->hasProduct) and empty($project->hasProduct) and !empty($_POST['plans']))
/* Filter empty plans. */
if(!empty($_POST['plans']))
{
$plansItem = array();
foreach($_POST['plans'] as $planItem)
{
if(empty($planItem[0][0])) continue;
$plansItem[] = $planItem[0][0];
}
$_POST['plans'] = array($_POST['products'][0] => array(0 => $plansItem));
foreach($_POST['plans'] as $key => $planItem) $_POST['plans'][$key] = array_filter($_POST['plans'][$key]);
$_POST['plans'] = array_filter($_POST['plans']);
}
$executionID = $this->execution->create($copyExecutionID);
@@ -1912,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;
@@ -2006,15 +1994,11 @@ class execution extends control
$newPlans = array();
if(isset($_POST['plans']))
{
foreach($_POST['plans'] as $plans)
{
foreach($plans as $planList)
foreach($plans as $planID)
{
foreach($planList as $planID)
{
if(array_search($planID, $oldPlans) === false) $newPlans[$planID] = $planID;
}
if(array_search($planID, $oldPlans) === false) $newPlans[$planID] = $planID;
}
}
}
@@ -4114,22 +4098,7 @@ class execution extends control
unset($fields[$key]);
}
$executionStats = $this->execution->getStatData($projectID, $status == 'byproduct' ? 'all' : $status, $productID, 0, false, '', 'id_asc');
if(isset($project->model) and $project->model == 'waterfall')
{
$stageList = array();
foreach($executionStats as $stage)
{
$stageList[] = $stage;
foreach($stage->children as $child)
{
$child->name = $stage->name . '/' . $child->name;
$stageList[] = $child;
}
}
$executionStats = $stageList;
}
$executionStats = $this->execution->getStatData($projectID, $status == 'byproduct' ? 'all' : $status, $productID, 0, false, 'hasParentName', 'order_asc');
$users = $this->loadModel('user')->getPairs('noletter');
foreach($executionStats as $i => $execution)
@@ -4140,6 +4109,7 @@ class execution extends control
$execution->totalConsumed = $execution->hours->totalConsumed;
$execution->totalLeft = $execution->hours->totalLeft;
$execution->progress = $execution->hours->progress . '%';
$execution->name = isset($execution->title) ? $execution->title : $execution->name;
if($this->app->tab == 'project' and ($project->model == 'agileplus' or $project->model == 'waterfallplus')) $execution->method = zget($executionLang->typeList, $execution->type);
if($this->post->exportType == 'selected')
+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');
+15 -7
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'>
@@ -140,7 +138,7 @@
<?php $this->printExtendFields('', 'table', 'columns=3');?>
<?php $hidden = 'hide'?>
<?php if(!empty($project->hasProduct)) $hidden = ''?>
<?php if($products):?>
<?php if(isset($project->hasProduct) and !empty($project->hasProduct) and $products):?>
<?php $i = 0;?>
<?php foreach($products as $product):?>
<tr class="<?php echo $hidden;?>">
@@ -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>
@@ -184,6 +182,16 @@
</tr>
<?php $i ++;?>
<?php endforeach;?>
<?php elseif(!empty($project) and empty($project->hasProduct)):?>
<tr>
<th><?php echo $lang->execution->linkPlan;?></th>
<td id="plansBox">
<?php $planProductID = current(array_keys($allProducts));?>
<?php echo html::select("plans[$planProductID][]", isset($productPlan) ? $productPlan : array(), '', "class='form-control chosen' multiple");?>
<?php echo html::hidden("products[]", $planProductID);?>
<?php echo html::hidden("branch[0][0]", '0');?>
</td>
</tr>
<?php else:?>
<tr class='<?php echo $hidden;?>'>
<th id='productTitle'><?php echo $lang->project->manageProductPlan;?></th>
@@ -209,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>
+11 -1
View File
@@ -151,7 +151,7 @@
<?php if($project->model != 'waterfall' and $project->model != 'waterfallplus'): ?>
<?php $hidden = 'hide'?>
<?php if(!empty($project->hasProduct)) $hidden = ''?>
<?php if($linkedProducts):?>
<?php if(!empty($project) and !empty($project->hasProduct) and $linkedProducts):?>
<?php $i = 0;?>
<?php foreach($linkedProducts as $product):?>
<tr class="<?php echo $hidden;?>">
@@ -195,6 +195,16 @@
</tr>
<?php $i ++;?>
<?php endforeach;?>
<?php elseif(!empty($project) and empty($project->hasProduct)):?>
<tr>
<th><?php echo $lang->execution->linkPlan;?></th>
<td id="plansBox">
<?php $planProductID = current(array_keys($linkedProducts));?>
<?php echo html::select("plans[$planProductID][]", isset($productPlans[$planProductID]) ? $productPlans[$planProductID] : array(), isset($linkedProducts[$planProductID]) ? $linkedProducts[$planProductID]->plans : '', "class='form-control chosen' multiple");?>
<?php echo html::hidden("products[]", $planProductID);?>
<?php echo html::hidden("branch[0][0]", '0');?>
</td>
</tr>
<?php else:?>
<tr class='<?php echo $hidden;?>'>
<th id='productTitle'><?php echo $lang->project->manageProductPlan;?></th>
+2 -1
View File
@@ -411,7 +411,8 @@
<div class="modal-body">
<div class='input-group'>
<?php echo html::select('plan', $allPlans, '', "class='form-control chosen' id='plan'");?>
<?php $disabled = empty(array_filter($allPlans)) ? 'disabled' : ''?>
<?php $allPlans = array_filter($allPlans);?>
<?php $disabled = empty($allPlans) ? 'disabled' : ''?>
<span class='input-group-btn'><?php echo html::commonButton($lang->execution->linkStory, "id='toTaskButton'", 'btn btn-primary ' . $disabled);?></span>
</div>
</div>
+1 -1
View File
@@ -1109,7 +1109,7 @@ class productplanModel extends model
foreach($planStory as $id => $story)
{
$projectBranches = zget($projectProducts, $story->product, array());
if($story->status == 'active' or (!empty($story->branch) and !empty($projectBranches) and !isset($projectBranches[$story->branch])))
if($story->status != 'active' or (!empty($story->branch) and !empty($projectBranches) and !isset($projectBranches[$story->branch])))
{
unset($planStory[$id]);
continue;
+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
@@ -140,7 +140,7 @@
<?php $disabled = isset($plan->setMilestone) ? '' : "disabled='disabled'"?>
<?php echo html::hidden("planIDList[$i]", $plan->id);?>
<tr>
<td class='<?php echo $typeClass;?>'><?php echo html::select("type[$i]", $lang->execution->typeList, $plan->type, "class='form-control chosen'");?></td>
<td class='<?php echo $typeClass . ' text-center ' .zget($lang->execution->typeList, $plan->type);?>'><?php echo zget($lang->execution->typeList, $plan->type);?></td>
<td><input type='text' name="names[<?php echo $i;?>]" id='names<?php echo $i;?>' value='<?php echo $plan->name;?>' class='form-control' /></td>
<?php if(!isset($config->setCode) or $config->setCode == 1):?>
<td><?php echo html::input("codes[$i]", $plan->code, "class='form-control'");?></td>
+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())
});
})