* Finish task #8164.
This commit is contained in:
@@ -150,6 +150,8 @@ class router extends baseRouter
|
||||
$productIndex = $storyIndex = $hourIndex = $planIndex = $URAndSR = 0;
|
||||
$projectIndex = empty($this->config->isINT) ? 0 : 1;
|
||||
|
||||
$model = new stdclass();
|
||||
$model->model = 'scrum';
|
||||
if($this->session->PRJ) $model = $this->dbh->query('SELECT model FROM' . TABLE_PROJECT . "WHERE id = {$this->session->PRJ}")->fetch();
|
||||
|
||||
foreach($commonSettings as $setting)
|
||||
|
||||
+14
-17
@@ -249,15 +249,12 @@ class upgrade extends control
|
||||
}
|
||||
elseif($type == 'moreLink')
|
||||
{
|
||||
foreach($this->post->programs as $i => $programID)
|
||||
foreach($this->post->projects as $i => $projectID)
|
||||
{
|
||||
$projectID = $this->post->projects[$i];
|
||||
$sprintID = $this->post->sprints[$i];
|
||||
|
||||
/* Change program field for product and project. */
|
||||
$this->upgrade->setProgram4Project($programID, array($projectID));
|
||||
|
||||
/* Set program team. */
|
||||
$this->upgrade->setProgramTeam($programID, array(), array($projectID));
|
||||
$this->upgrade->processMergedData(0, $projectID, array(), array($sprintID));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,31 +373,31 @@ class upgrade extends control
|
||||
/* Get no merged projects that link more then two products. */
|
||||
if($type == 'moreLink')
|
||||
{
|
||||
$noMergedProjects = $this->dao->select('*')->from(TABLE_PROJECT)->where('model')->eq('')->andWhere('deleted')->eq(0)->fetchAll('id');
|
||||
$projectProducts = $this->dao->select('*')->from(TABLE_PROJECTPRODUCT)->where('project')->in(array_keys($noMergedProjects))->fetchGroup('project', 'product');
|
||||
$noMergedSprints = $this->dao->select('*')->from(TABLE_PROJECT)->where('parent')->eq(0)->andWhere('path')->eq('')->fetchAll('id');
|
||||
$projectProducts = $this->dao->select('*')->from(TABLE_PROJECTPRODUCT)->where('project')->in(array_keys($noMergedSprints))->fetchGroup('project', 'product');
|
||||
|
||||
$productPairs = array();
|
||||
foreach($projectProducts as $projectID => $products)
|
||||
foreach($projectProducts as $sprintID => $products)
|
||||
{
|
||||
foreach($products as $productID => $data) $productPairs[$productID] = $productID;
|
||||
}
|
||||
|
||||
$programs = $this->dao->select('t1.*,t2.id as productID')->from(TABLE_PROJECT)->alias('t1')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.id=t2.program')
|
||||
->where('t2.id')->in($productPairs)
|
||||
$projects = $this->dao->select('t1.*,t2.product as productID')->from(TABLE_PROJECT)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id=t2.project')
|
||||
->where('t2.product')->in($productPairs)
|
||||
->fetchAll('productID');
|
||||
|
||||
foreach($noMergedProjects as $projectID => $project)
|
||||
foreach($noMergedSprints as $sprintID => $sprint)
|
||||
{
|
||||
$products = zget($projectProducts, $projectID, array());
|
||||
$products = zget($projectProducts, $sprintID, array());
|
||||
foreach($products as $productID => $data)
|
||||
{
|
||||
$program = zget($programs, $productID, '');
|
||||
if($program) $project->programs[$program->id] = $program->name;
|
||||
$project = zget($projects, $productID, '');
|
||||
if($project) $sprint->projects[$project->id] = $project->name;
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->noMergedProjects = $noMergedProjects;
|
||||
$this->view->noMergedSprints = $noMergedSprints;
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->upgrade->mergeProgram;
|
||||
|
||||
@@ -21,6 +21,19 @@ $(function()
|
||||
setPgmBegin(pgmBegin);
|
||||
})
|
||||
|
||||
$('#longTime').change(function()
|
||||
{
|
||||
if($(this).prop('checked'))
|
||||
{
|
||||
$('#end').val('').attr('disabled', 'disabled');
|
||||
$('#days').val('');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#end').removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
$('#lineList li a').click(function()
|
||||
{
|
||||
/* Active current li and remove active before li. */
|
||||
|
||||
+40
-60
@@ -3854,17 +3854,20 @@ class upgradeModel extends model
|
||||
*/
|
||||
public function createProgram($productIdList = array(), $projectIdList = array())
|
||||
{
|
||||
$this->app->loadLang('program');
|
||||
$data = fixer::input('post')->get();
|
||||
|
||||
if(!isset($data->programs))
|
||||
{
|
||||
if(!$this->post->longTime and !$this->post->end) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->program->end)));
|
||||
|
||||
/* Insert program. */
|
||||
$program = new stdclass();
|
||||
$program->name = $data->PGMName;
|
||||
$program->type = 'program';
|
||||
$program->status = 'wait';
|
||||
$program->begin = $data->begin;
|
||||
$program->end = $data->end;
|
||||
$program->end = isset($data->end) ? $data->end : '';
|
||||
$program->openedBy = $this->app->user->account;
|
||||
$program->openedDate = helper::now();
|
||||
$program->openedVersion = $this->config->version;
|
||||
@@ -3875,10 +3878,9 @@ class upgradeModel extends model
|
||||
$this->lang->project->name = $this->lang->program->PGMName;
|
||||
|
||||
$this->dao->insert(TABLE_PROJECT)->data($program)
|
||||
->batchcheck('name,begin,end', 'notempty')
|
||||
->batchcheck('name,begin', 'notempty')
|
||||
->checkIF($program->end != '', 'end', 'gt', $program->begin)
|
||||
->check('name', 'unique', "deleted='0'")
|
||||
->check('code', 'unique', "deleted='0'")
|
||||
->exec();
|
||||
if(dao::isError()) return false;
|
||||
|
||||
@@ -3890,12 +3892,16 @@ class upgradeModel extends model
|
||||
$programID = $data->programs;
|
||||
}
|
||||
|
||||
if(!isset($data->programs))
|
||||
if(!isset($data->projects))
|
||||
{
|
||||
if(!$this->post->longTime and !$this->post->end) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->program->end)));
|
||||
|
||||
/* Insert project. */
|
||||
$project = new stdclass();
|
||||
$project->name = $data->PRJName;
|
||||
$project->type = 'project';
|
||||
$project->model = 'scrum';
|
||||
$project->code = $data->code;
|
||||
$project->parent = $programID;
|
||||
$project->status = 'wait';
|
||||
$project->begin = $data->begin;
|
||||
@@ -3911,9 +3917,8 @@ class upgradeModel extends model
|
||||
$this->lang->project->code = $this->lang->program->PRJCode;
|
||||
|
||||
$this->dao->insert(TABLE_PROJECT)->data($project)
|
||||
->batchcheck('name,code', 'notempty')
|
||||
->batchcheck('name', 'notempty')
|
||||
->check('name', 'unique', "deleted='0'")
|
||||
->check('code', 'unique', "deleted='0'")
|
||||
->exec();
|
||||
if(dao::isError()) return false;
|
||||
|
||||
@@ -3928,49 +3933,6 @@ class upgradeModel extends model
|
||||
return array($programID, $projectID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create product for program.
|
||||
*
|
||||
* @param int $programID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createProduct4Program($programID)
|
||||
{
|
||||
$program = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($programID)->fetch();
|
||||
|
||||
$product = $this->dao->select('*')->from(TABLE_PRODUCT)->where('program')->eq($programID)->andWhere('deleted')->eq(0)->andWhere('code')->eq($program->code)->fetch();
|
||||
if($product) return $product->id;
|
||||
|
||||
$product = new stdclass();
|
||||
$product->name = $program->name;
|
||||
$product->code = $program->code;
|
||||
$product->program = $program->id;
|
||||
$product->type = 'normal';
|
||||
$product->status = 'normal';
|
||||
$product->acl = $program->acl;
|
||||
$product->whitelist = $program->whitelist;
|
||||
$product->createdBy = $program->createdBy;
|
||||
$product->createdDate = $program->createdDate;
|
||||
$product->createdVersion = $this->config->version;
|
||||
|
||||
$this->dao->insert(TABLE_PRODUCT)->data($product)->exec();
|
||||
$productID = $this->dao->lastInsertId();
|
||||
$this->dao->update(TABLE_PRODUCT)->set('`order`')->eq($productID * 5)->where('id')->eq($productID)->exec();
|
||||
|
||||
$this->app->loadLang('doc');
|
||||
$lib = new stdclass();
|
||||
$lib->product = $productID;
|
||||
$lib->name = $this->lang->doclib->main['product'];
|
||||
$lib->type = 'product';
|
||||
$lib->main = '1';
|
||||
$lib->acl = 'default';
|
||||
$this->dao->insert(TABLE_DOCLIB)->data($lib)->exec();
|
||||
if($product->acl != 'open') $this->loadModel('user')->updateUserView($productID, 'product');
|
||||
|
||||
return $productID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace program or PRJ id for product and project linked objects.
|
||||
*
|
||||
@@ -3999,7 +3961,8 @@ class upgradeModel extends model
|
||||
$this->dao->update(TABLE_DOC)->set('PRJ')->eq($projectID)->where("lib IN(SELECT id from " . TABLE_DOCLIB . " WHERE type = 'project' and project " . helper::dbIN($sprintIdList) . ')')->exec();
|
||||
|
||||
/* Compute sprint path and grade. */
|
||||
foreach($sprintIdList as $sprint)
|
||||
$sprints = $this->dao->select('id, type')->from(TABLE_PROJECT)->where('id')->in($sprintIdList)->fetchAll();
|
||||
foreach($sprints as $sprint)
|
||||
{
|
||||
$data = new stdclass();
|
||||
$data->project = $projectID;
|
||||
@@ -4013,11 +3976,11 @@ class upgradeModel extends model
|
||||
}
|
||||
|
||||
/* Set product and project relation. */
|
||||
foreach($productIdList as $product)
|
||||
foreach($productIdList as $productID)
|
||||
{
|
||||
$data = new stdclass();
|
||||
$data->project = $projectID;
|
||||
$data->product = $product->id;
|
||||
$data->product = $productID;
|
||||
|
||||
$this->dao->replace(TABLE_PROJECTPRODUCT)->data($data)->exec();
|
||||
}
|
||||
@@ -4049,13 +4012,13 @@ class upgradeModel extends model
|
||||
if(isset($product->feedback)) $teams[$product->feedback] = $product->feedback;
|
||||
}
|
||||
|
||||
foreach($projects as $project)
|
||||
foreach($sprints as $sprint)
|
||||
{
|
||||
$teams[$project->PO] = $project->PO;
|
||||
$teams[$project->PM] = $project->PM;
|
||||
$teams[$project->QD] = $project->QD;
|
||||
$teams[$project->RD] = $project->RD;
|
||||
if(isset($project->feedback)) $teams[$project->feedback] = $project->feedback;
|
||||
$teams[$sprint->PO] = $sprint->PO;
|
||||
$teams[$sprint->PM] = $sprint->PM;
|
||||
$teams[$sprint->QD] = $sprint->QD;
|
||||
$teams[$sprint->RD] = $sprint->RD;
|
||||
if(isset($sprint->feedback)) $teams[$sprint->feedback] = $sprint->feedback;
|
||||
}
|
||||
|
||||
$teams += $this->dao->select('account')->from(TABLE_TEAM)->where('type')->eq('project')->andWhere('root')->in($sprintIdList)->fetchPairs('account', 'account');
|
||||
@@ -4082,10 +4045,27 @@ class upgradeModel extends model
|
||||
->andWhere('root')->in($sprintIdList)
|
||||
->exec();
|
||||
|
||||
/* Get all white list. */
|
||||
/* Get all actor in sprint and product. */
|
||||
foreach($productIdList as $productID) $productIdList[$productID] = ",{$productID},";
|
||||
$whiteList = $this->dao->select('actor')->from(TABLE_ACTION)->where('project')->in($sprintIdList)->orWhere('product')->in($productIdList)->fetchPairs('actor', 'actor');
|
||||
$whiteList = array_diff($whiteList, $team);
|
||||
$whiteList = array_diff($whiteList, $teams);
|
||||
|
||||
/* Get all white list in sprint and product. */
|
||||
$groups = array();
|
||||
foreach($products as $product)
|
||||
{
|
||||
if($product->acl != 'custom' || $product->whitelist) return;
|
||||
$groups += explode(',', $product->whitelist);
|
||||
}
|
||||
|
||||
foreach($sprints as $sprint)
|
||||
{
|
||||
if($sprint->acl != 'custom' || $sprint->whitelist) return;
|
||||
$groups += explode(',', $sprint->whitelist);
|
||||
}
|
||||
|
||||
$users = $groups ? $this->dao->select('account')->from(TABLE_USERGROUP)->where('`group`')->in($groups)->fetchPairs() : array();
|
||||
foreach($users as $account) $whiteList[$account] = $account;
|
||||
|
||||
/* Insert whiteList into program and projec. */
|
||||
if($whiteList)
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</tr>
|
||||
<tr class='pgmParams'>
|
||||
<th><?php echo $lang->program->PRJCode;?></th>
|
||||
<td class='required'><?php echo html::input("code", '', "class='form-control'");?></td>
|
||||
<td><?php echo html::input("code", '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr class='pgmParams'>
|
||||
<th><?php echo $lang->program->PRJPM;?></th>
|
||||
@@ -55,6 +55,12 @@
|
||||
<?php echo html::input('begin', date('Y-m-d'), "class='form-control form-date' onchange='computeWorkDays();' placeholder='" . $lang->program->begin . "' required");?>
|
||||
<span class='input-group-addon'><?php echo $lang->program->to;?></span>
|
||||
<?php echo html::input('end', '', "class='form-control form-date' onchange='computeWorkDays();' placeholder='" . $lang->program->end . "' required");?>
|
||||
<span class='input-group-addon' id='longTimeBox'>
|
||||
<div class="checkbox-primary">
|
||||
<input type="checkbox" name="longTime" value="1" id="longTime">
|
||||
<label for="longTime"><?php echo $lang->program->PRJLongTime;?></label>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<style> #source .lineGroup .productList{width: 250px;} </style>
|
||||
<style> #source .lineGroup .productList{width: 170px;} </style>
|
||||
<?php $selected = key($productlines);?>
|
||||
<div class='alert alert-info'>
|
||||
<?php
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
<div class='table-row'>
|
||||
<style> .sprint-group{padding: 10px 0px}</style>
|
||||
<div class='alert alert-info'>
|
||||
<?php
|
||||
printf($lang->upgrade->mergeSummary, $noMergedProductCount, $noMergedSprintCount);
|
||||
echo '<br />' . $lang->upgrade->mergeByProject;
|
||||
?>
|
||||
</div>
|
||||
<div class='main-row'>
|
||||
<div class='table-col' id='source'>
|
||||
<div class='alert alert-info'>
|
||||
<?php
|
||||
printf($lang->upgrade->mergeSummary, $noMergedProductCount, $noMergedSprintCount);
|
||||
echo '<br />' . $lang->upgrade->mergeByProject;
|
||||
?>
|
||||
</div>
|
||||
<table class='table table-form'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo $lang->upgrade->project;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<div class='cell'>
|
||||
<div class='item'><strong><?php echo $lang->upgrade->project;?></strong></div>
|
||||
<div class='sprint-group'>
|
||||
<?php foreach($noMergedSprints as $sprintID => $sprint):?>
|
||||
<tr>
|
||||
<td><?php echo html::checkBox("sprint", array($sprint->id => "{$lang->upgrade->project} #{$sprint->id} {$sprint->name}"), $sprint->id);?></td>
|
||||
<td><?php echo html::checkBox("sprints", array($sprint->id => "{$lang->upgrade->project} #{$sprint->id} {$sprint->name}"), $sprint->id);?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='table-col divider strong'></div>
|
||||
<div class='table-col pgmWidth' id='programBox'><?php include "./createprogram.html.php";?></div>
|
||||
<div class='table-col pgmWidth' id='programBox'>
|
||||
<div class='cell'><?php include "./createprogram.html.php";?></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<?php elseif($type == 'moreLink'):?>
|
||||
<div class='alert alert-info'>
|
||||
<?php
|
||||
printf($lang->upgrade->mergeSummary, $noMergedProductCount, $noMergedProjectCount);
|
||||
printf($lang->upgrade->mergeSummary, $noMergedProductCount, $noMergedSprintCount);
|
||||
echo '<br />' . $lang->upgrade->mergeByMoreLink;
|
||||
?>
|
||||
</div>
|
||||
@@ -37,15 +37,15 @@
|
||||
<tr>
|
||||
<th><?php echo $lang->upgrade->project;?></th>
|
||||
<th class='divider'></th>
|
||||
<th class='gray w-p50'><?php echo $lang->upgrade->program;?></th>
|
||||
<th class='w-p50'><?php echo $lang->upgrade->program;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($noMergedProjects as $projectID => $project):?>
|
||||
<?php foreach($noMergedSprints as $sprintID => $sprint):?>
|
||||
<tr>
|
||||
<td><?php echo "{$lang->projectCommon} #{$project->id} {$project->name}" . html::hidden("projects[]", $project->id);?></td>
|
||||
<td><?php echo "{$lang->upgrade->project} #{$sprint->id} {$sprint->name}" . html::hidden("sprints[]", $sprint->id);?></td>
|
||||
<td class='divider'><i class='icon icon-angle-double-right'></i></td>
|
||||
<td><?php echo html::select("programs[]", $project->programs, '', "class='form-control chosen'");?></td>
|
||||
<td><?php echo html::select("projects[]", $sprint->projects, '', "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
|
||||
@@ -1368,7 +1368,7 @@ class userModel extends model
|
||||
if($allProducts === null) $allProducts = $this->dao->select('id,PO,QD,RD,createdBy,acl,whitelist,program')->from(TABLE_PRODUCT)->where('acl')->ne('open')->fetchAll('id');
|
||||
if($allProjects === null) $allProjects = $this->dao->select('id,PO,PM,QD,RD,acl')->from(TABLE_PROJECT)->where('acl')->ne('open')->andWhere('type')->eq('project')->fetchAll('id');
|
||||
if($allPrograms === null) $allPrograms = $this->dao->select('id,PO,PM,QD,RD,acl')->from(TABLE_PROJECT)->where('acl')->ne('open')->andWhere('type')->eq('program')->fetchAll('id');
|
||||
if($allSprints === null) $allSprints = $this->dao->select('id,PO,PM,QD,RD,acl')->from(TABLE_PROJECT)->where('acl')->eq('private')->andWhere('type')->in('sprint,stage')->fetchAll('id');
|
||||
if($allSprints === null) $allSprints = $this->dao->select('id,PO,PM,QD,RD,acl,project,type')->from(TABLE_PROJECT)->where('acl')->eq('private')->andWhere('type')->in('sprint,stage')->fetchAll('id');
|
||||
|
||||
/* Get teams. */
|
||||
if($teams === null)
|
||||
|
||||
Reference in New Issue
Block a user