* Finish task #71569.
This commit is contained in:
@@ -16,7 +16,7 @@ $config->port->dateFeilds = 'estStarted,realStarted,deadline,openedDate,assi
|
||||
$config->port->datetimeFeilds = '';
|
||||
$config->port->listFields = '';
|
||||
$config->port->sysLangFields = ',pri,status,type,mode,severity,os,browser,resolution,confirmed,source,reviewResult,stage,change,category';
|
||||
$config->port->sysDataFields = 'execution,product,user';
|
||||
$config->port->sysDataFields = 'project,execution,product,user';
|
||||
$config->port->userFields = 'assignedTo,openedBy,finishedBy,canceledBy,closedBy,lastEditedBy,lastRunner,resolvedBy,reviewedBy,mailto';
|
||||
|
||||
$config->port->defaultZeroField = 'severity,pri';
|
||||
|
||||
@@ -2209,51 +2209,6 @@ class project extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: Check products.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxCheckProduct($programID, $projectID)
|
||||
{
|
||||
/* Set vars. */
|
||||
$project = $this->project->getByID($projectID);
|
||||
$oldTopPGM = $this->loadModel('program')->getTopByID($project->parent);
|
||||
$newTopPGM = $this->program->getTopByID($programID);
|
||||
|
||||
if($oldTopPGM == $newTopPGM) return;
|
||||
|
||||
$response = array();
|
||||
$response['result'] = true;
|
||||
$response['message'] = $this->lang->project->changeProgramTip;
|
||||
|
||||
/* Get new program products. */
|
||||
$newProducts = $this->program->getProductPairs($programID, 'assign', 'noclosed');
|
||||
$response['newProducts'] = html::select("newProducts", array('0' => '') + $newProducts, '', "class='form-control chosen' onchange='loadBranches(this)'");
|
||||
|
||||
$multiLinkedProducts = $this->project->getMultiLinkedProducts($projectID);
|
||||
$canChange = true;
|
||||
if($multiLinkedProducts)
|
||||
{
|
||||
$multiLinkedProjects = array();
|
||||
$programIdList = $this->dao->select('id, program')->from(TABLE_PRODUCT)->where('id')->in(array_keys($multiLinkedProducts))->fetchPairs();
|
||||
foreach($multiLinkedProducts as $productID => $product)
|
||||
{
|
||||
if($programIdList[$productID] != $newTopPGM) $canChange = false;
|
||||
$multiLinkedProjects[$productID] = $this->loadModel('product')->getProjectPairsByProduct($productID);
|
||||
}
|
||||
$response['result'] = false;
|
||||
$response['message'] = $multiLinkedProducts;
|
||||
$response['multiLinkedProjects'] = $multiLinkedProjects;
|
||||
}
|
||||
|
||||
if($canChange) return true;
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: get executions of a project in html select.
|
||||
*
|
||||
|
||||
@@ -4,63 +4,6 @@ $(function()
|
||||
{
|
||||
var programID = $(this).val();
|
||||
setAclList(programID);
|
||||
|
||||
/* Determine whether the project can change the project set. */
|
||||
link = createLink('project', 'ajaxCheckProduct', 'programID=' + programID + '&projectID=' + projectID);
|
||||
$.getJSON(link, function(data)
|
||||
{
|
||||
var changed = true;
|
||||
|
||||
if(data && data.result)
|
||||
{
|
||||
changed = confirm(data.message);
|
||||
if(changed)
|
||||
{
|
||||
/* Select change to the new program products. */
|
||||
var lastProductSelect = $('#productsBox .input-group:last select:first');
|
||||
if($(lastProductSelect).val() == 0)
|
||||
{
|
||||
var lastProductSelectID = $(lastProductSelect).attr("id");
|
||||
var lastProductSelectName = $(lastProductSelect).attr("name");
|
||||
$('#' + lastProductSelectID + '_chosen').remove();
|
||||
$(lastProductSelect).replaceWith(data.newProducts);
|
||||
$('#productsBox .input-group:last select:first').attr('name', lastProductSelectName).attr('id', lastProductSelectID).chosen();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data && !data.result)
|
||||
{
|
||||
$('#promptTable tbody tr').remove();
|
||||
for(var i in data.message)
|
||||
{
|
||||
var product = data.message[i];
|
||||
$('#promptTable').append("<tr><td><i class='icon icon-product'></i> <strong>" + product +"</strong> " + linkedProjectsTip +"</td></tr>");
|
||||
for(var j in data.multiLinkedProjects)
|
||||
{
|
||||
if(i == j)
|
||||
{
|
||||
html = ''
|
||||
for(k in data.multiLinkedProjects[j])
|
||||
{
|
||||
var project = data.multiLinkedProjects[j][k];
|
||||
html += "<p><i class='icon icon-project'></i> " + project +"</p>";
|
||||
}
|
||||
$('#promptTable').append("<tr><td style='padding-left:40px'>" + html + "</td></tr>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
changed = false;
|
||||
$('#promptBox').modal({show: true});
|
||||
}
|
||||
|
||||
if(!changed) $("#parent").val(oldParent).trigger("chosen:updated");
|
||||
oldParent = $('#parent').val();
|
||||
|
||||
budgetOverrunTips();
|
||||
outOfDateTip();
|
||||
});
|
||||
});
|
||||
|
||||
adjustProductBoxMargin();
|
||||
|
||||
@@ -768,6 +768,21 @@ class projectModel extends model
|
||||
return $statData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getPairs()
|
||||
{
|
||||
return $this->dao->select('id, name')->from(TABLE_PROJECT)
|
||||
->where('type')->eq('project')
|
||||
->andWhere('deleted')->eq(0)
|
||||
->andWhere('vision')->eq($this->config->vision)
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project pairs by programID.
|
||||
*
|
||||
@@ -1465,6 +1480,7 @@ class projectModel extends model
|
||||
->where('project')->eq($project->id)
|
||||
->andWhere('deleted')->eq('0')
|
||||
->fetchAll();
|
||||
|
||||
if(!empty($executionsCount))
|
||||
{
|
||||
$minExecutionBegin = $this->dao->select('begin as minBegin')->from(TABLE_PROJECT)->where('project')->eq($project->id)->andWhere('deleted')->eq('0')->orderBy('begin_asc')->fetch();
|
||||
@@ -1560,7 +1576,6 @@ class projectModel extends model
|
||||
|
||||
if(!dao::isError())
|
||||
{
|
||||
$this->updateProductProgram($oldProject->parent, $project->parent, $_POST['products']);
|
||||
$this->updateProducts($projectID, $_POST['products']);
|
||||
$this->file->updateObjectID($this->post->uid, $projectID, 'project');
|
||||
|
||||
@@ -2329,13 +2344,6 @@ class projectModel extends model
|
||||
$existedProducts[$productID][$branch] = true;
|
||||
}
|
||||
|
||||
/* Delete the execution linked products that is not linked with the execution. */
|
||||
if((int)$projectID > 0)
|
||||
{
|
||||
$executions = $this->dao->select('id')->from(TABLE_EXECUTION)->where('project')->eq((int)$projectID)->fetchPairs('id');
|
||||
$this->dao->delete()->from(TABLE_PROJECTPRODUCT)->where('project')->in($executions)->andWhere('product')->notin($products)->exec();
|
||||
}
|
||||
|
||||
$oldProductKeys = array_keys($oldProjectProducts);
|
||||
$needUpdate = array_merge(array_diff($oldProductKeys, $products), array_diff($products, $oldProductKeys));
|
||||
if($needUpdate) $this->user->updateUserView($needUpdate, 'product', $members);
|
||||
|
||||
@@ -245,24 +245,4 @@
|
||||
<div id='programAcl' class='hidden'>
|
||||
<?php echo nl2br(html::radio('acl', $lang->project->subAclList, $project->acl, "onclick='setWhite(this.value);'", 'block'));?>
|
||||
</div>
|
||||
<div class="modal fade" id="promptBox">
|
||||
<div class="modal-dialog mw-600px">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon icon-close"></i></button>
|
||||
<h4 class="modal-title"><?php printf($lang->project->changeProgram, $project->name);?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table class='table table-form' id='promptTable'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='text-left'><?php echo $lang->project->multiLinkedProductsTip;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user