* Fix bugs.

This commit is contained in:
hufangzhou
2021-01-21 16:03:34 +08:00
parent 8ca990dfb8
commit 1bfaba7751
15 changed files with 122 additions and 44 deletions
+2 -3
View File
@@ -124,7 +124,6 @@ class product extends control
{
/* Lower browse type. */
$browseType = strtolower($browseType);
$projectStoryBrowseType = $browseType;
/* Load datatable. */
$this->loadModel('datatable');
@@ -200,8 +199,8 @@ class product extends control
$products = $this->product->getProductsByProject($this->session->PRJ);
$productPlans = $this->loadModel('project')->getPlans($products);
if($projectStoryBrowseType == 'bybranch') $param = $branch;
$stories = $this->story->getProjectStories($this->session->PRJ, $sort, $projectStoryBrowseType, $param, 'story', '', $pager, $productID, $branch);
if($browseType == 'bybranch') $param = $branch;
$stories = $this->story->getProjectStories($this->session->PRJ, $sort, $browseType, $param, 'story', '', $pager, $productID, $branch);
}
/* Process the sql, get the conditon partion, save it to session. */
+29 -16
View File
@@ -965,14 +965,14 @@ class program extends control
$this->loadModel('productplan');
/* Navigation stay in program when enter from program list. */
if($from == 'PRJ')
if($from == 'PRJ')
{
$this->lang->program->menu = $this->lang->waterfall->setMenu;
$moduleIndex = array_search('program', $this->lang->noMenuModule);
if($moduleIndex !== false) unset($this->lang->noMenuModule[$moduleIndex]);
$this->lang->navGroup->program = 'project';
}
if($from == 'pgmbrowse')
if($from == 'pgmbrowse')
{
$this->lang->navGroup->program = 'program';
}
@@ -1006,6 +1006,18 @@ class program extends control
$linkedProducts = $programID != $project->parent ? array() : $this->project->getProducts($projectID);
$parentProgram = $this->program->getPGMByID($programID);
/* If the story of the product which linked the execution under the project, you don't allow to remove the product. */
$projectStories = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($projectID)->fetchAll('story');
$projectStoryIdList = array_keys($projectStories);
$notRemoveProducts = array();
foreach($linkedProducts as $productID => $linkedProduct)
{
$productStories = $this->loadModel('story')->getProductStories($productID);
$productStoryIdList = array_keys($productStories);
$storyIntersect = array_intersect($projectStoryIdList, $productStoryIdList);
if(!empty($storyIntersect)) array_push($notRemoveProducts, $productID);
}
foreach($linkedProducts as $product)
{
if(!isset($allProducts[$product->id])) $allProducts[$product->id] = $product->name;
@@ -1020,20 +1032,21 @@ class program extends control
$this->view->title = $this->lang->program->PRJEdit;
$this->view->position[] = $this->lang->program->PRJEdit;
$this->view->PMUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst', $project->PM);
$this->view->users = $this->user->getPairs('noclosed|nodeleted');
$this->view->project = $project;
$this->view->programList = $this->program->getParentPairs();
$this->view->programID = $programID;
$this->view->allProducts = array('0' => '') + $allProducts;
$this->view->productPlans = $productPlans;
$this->view->linkedProducts = $linkedProducts;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts), '', $linkedBranches);
$this->view->URSRPairs = $this->loadModel('custom')->getURSRPairs();
$this->view->from = $from;
$this->view->parentProgram = $parentProgram;
$this->view->remainBudget = $this->program->getParentRemainBudget($parentProgram) + $project->budget;
$this->view->budgetUnitList = $this->program->getBudgetUnitList();
$this->view->PMUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst', $project->PM);
$this->view->users = $this->user->getPairs('noclosed|nodeleted');
$this->view->project = $project;
$this->view->programList = $this->program->getParentPairs();
$this->view->programID = $programID;
$this->view->allProducts = array('0' => '') + $allProducts;
$this->view->productPlans = $productPlans;
$this->view->linkedProducts = $linkedProducts;
$this->view->notRemoveProducts = $notRemoveProducts;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts), '', $linkedBranches);
$this->view->URSRPairs = $this->loadModel('custom')->getURSRPairs();
$this->view->from = $from;
$this->view->parentProgram = $parentProgram;
$this->view->remainBudget = $this->program->getParentRemainBudget($parentProgram) + $project->budget;
$this->view->budgetUnitList = $this->program->getBudgetUnitList();
$this->display();
}
+12
View File
@@ -7,6 +7,18 @@ $(function()
adjustProductBoxMargin();
adjustPlanBoxMargin();
/* If the story of the product which linked the execution under the project, you don't allow to remove the product. */
$("#productsBox select").each(function()
{
var isExisted = $.inArray($(this).attr('data-last'), notRemoveProducts);
if(isExisted != -1)
{
$(this).prop('disabled', true).trigger("chosen:updated");
$(this).siblings('div').find('span').attr('title', tip);
}
});
});
/**
+2
View File
@@ -20,6 +20,8 @@
<?php js::set('PGMChangeTips', $lang->program->PGMChangeTips);?>
<?php js::set('longTime', $lang->program->PRJLongTime);?>
<?php js::set('from', $from);?>
<?php js::set('notRemoveProducts', $notRemoveProducts)?>
<?php js::set('tip', $lang->program->notAllowRemoveProducts);?>
<?php $aclList = $project->parent ? $lang->program->PGMPRJAclList : $lang->program->PRJAclList;?>
<?php $requiredFields = $config->program->PRJEdit->requiredFields;?>
<div id='mainContent' class='main-content'>
@@ -26,7 +26,7 @@
<?php if(isset($linkedProducts[$productID])):?>
<?php $isDisabled = in_array($productID, $notRemoveProducts) ? "disabled='disabled'" : '';?>
<?php $title = in_array($productID, $notRemoveProducts) ? $lang->program->notAllowRemoveProducts : $productName;?>
<?php $checked = 'checked';?>
<?php $checked = 'checked';?>
<div class='col-sm-4'>
<div class='product <?php echo $checked . (isset($branchGroups[$productID]) ? ' has-branch' : '')?>'>
<div class="checkbox-primary" title='<?php echo $title;?>'>
+49 -21
View File
@@ -1288,6 +1288,19 @@ class project extends control
$linkedProducts = $this->project->getProducts($project->id);
$linkedBranches = array();
/* If the story of the product which linked the execution, you don't allow to remove the product. */
$projectStories = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($projectID)->fetchAll('story');
$projectStoryIdList = array_keys($projectStories);
$notRemoveProducts = array();
foreach($linkedProducts as $productID => $linkedProduct)
{
$productStories = $this->loadModel('story')->getProductStories($productID);
$productStoryIdList = array_keys($productStories);
$storyIntersect = array_intersect($projectStoryIdList, $productStoryIdList);
if(!empty($storyIntersect)) array_push($notRemoveProducts, $productID);
}
foreach($linkedProducts as $product)
{
if(!isset($allProducts[$product->id])) $allProducts[$product->id] = $product->name;
@@ -1326,21 +1339,22 @@ class project extends control
$rdUsers = $this->user->getPairs('noclosed|nodeleted|devfirst', $project->RD, $this->config->maxCount);
if(!empty($this->config->user->moreLink)) $this->config->moreLinks["RD"] = $this->config->user->moreLink;
$this->view->title = $title;
$this->view->position = $position;
$this->view->projects = $projects;
$this->view->project = $project;
$this->view->poUsers = $poUsers;
$this->view->pmUsers = $pmUsers;
$this->view->qdUsers = $qdUsers;
$this->view->rdUsers = $rdUsers;
$this->view->users = $this->user->getPairs('nodeleted|noclosed');
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->allProducts = $allProducts;
$this->view->linkedProducts = $linkedProducts;
$this->view->productPlans = $productPlans;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts), '', $linkedBranches);
$this->view->isStage = $PRJData->model == 'waterfall' ? true : false;
$this->view->title = $title;
$this->view->position = $position;
$this->view->projects = $projects;
$this->view->project = $project;
$this->view->poUsers = $poUsers;
$this->view->pmUsers = $pmUsers;
$this->view->qdUsers = $qdUsers;
$this->view->rdUsers = $rdUsers;
$this->view->users = $this->user->getPairs('nodeleted|noclosed');
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->allProducts = $allProducts;
$this->view->linkedProducts = $linkedProducts;
$this->view->notRemoveProducts = $notRemoveProducts;
$this->view->productPlans = $productPlans;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts), '', $linkedBranches);
$this->view->isStage = $PRJData->model == 'waterfall' ? true : false;
$this->display();
}
@@ -1994,6 +2008,19 @@ class project extends control
$allProducts = $this->product->getProductPairsByProject($project->project);
$linkedProducts = $this->project->getProducts($project->id);
$linkedBranches = array();
/* If the story of the product which linked the execution, you don't allow to remove the product. */
$projectStories = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($projectID)->fetchAll('story');
$projectStoryIdList = array_keys($projectStories);
$notRemoveProducts = array();
foreach($linkedProducts as $productID => $linkedProduct)
{
$productStories = $this->loadModel('story')->getProductStories($productID);
$productStoryIdList = array_keys($productStories);
$storyIntersect = array_intersect($projectStoryIdList, $productStoryIdList);
if(!empty($storyIntersect)) array_push($notRemoveProducts, $productID);
}
// Merge allProducts and linkedProducts for closed product.
foreach($linkedProducts as $product)
{
@@ -2002,12 +2029,13 @@ class project extends control
}
/* Assign. */
$this->view->title = $title;
$this->view->position = $position;
$this->view->allProducts = $allProducts;
$this->view->project = $project;
$this->view->linkedProducts = $linkedProducts;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($allProducts), '', $linkedBranches);
$this->view->title = $title;
$this->view->position = $position;
$this->view->allProducts = $allProducts;
$this->view->project = $project;
$this->view->linkedProducts = $linkedProducts;
$this->view->notRemoveProducts = $notRemoveProducts;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($allProducts), '', $linkedBranches);
$this->display();
}
+14
View File
@@ -6,3 +6,17 @@ $().ready(function()
$('#branch0').removeAttr("disabled");
});
});
$(function()
{
/* If the story of the product which linked the execution under the project, you don't allow to remove the product. */
$("#productsBox select").each(function()
{
var isExisted = $.inArray($(this).attr('data-last'), notRemoveProducts);
if(isExisted != -1)
{
$(this).prop('disabled', true).trigger("chosen:updated");
$(this).siblings('div').find('span').attr('title', tip);
}
});
})
+1
View File
@@ -275,6 +275,7 @@ $lang->project->confirmUnlinkMember = "Möchten Sie den Benutzer vom {$lan
$lang->project->confirmUnlinkStory = "Möchten Sie die Story vom {$lang->executionCommon} entfernen?";
$lang->project->confirmUnlinkProjectStory = "Do you want to unlink this Story from the project?";
$lang->project->notAllowedUnlinkStory = "This {$lang->SRCommon} is linked to the {$lang->executionCommon} of the project. Remove it from the {$lang->executionCommon}, then try again.";
$lang->project->notAllowRemoveProducts = "The story of this product is linked with the {$lang->executionCommon}. Unlink it before doing any action.";
$lang->project->errorNoLinkedProducts = "Kein verknüpftes {$lang->productCommon} in {$lang->executionCommon} gefunden. Sie werden auf die {$lang->productCommon} Seite geleitet.";
$lang->project->errorSameProducts = "{$lang->executionCommon} Kann nicht mit mehreren identischen {$lang->productCommon} verknüpft werden";
$lang->project->accessDenied = "Zugriff zu {$lang->executionCommon} verweigert!";
+1
View File
@@ -275,6 +275,7 @@ $lang->project->confirmUnlinkMember = "Do you want to unlink this User fro
$lang->project->confirmUnlinkStory = "Do you want to unlink this Story from {$lang->executionCommon}?";
$lang->project->confirmUnlinkProjectStory = "Do you want to unlink this Story from the project?";
$lang->project->notAllowedUnlinkStory = "This {$lang->SRCommon} is linked to the {$lang->executionCommon} of the project. Remove it from the {$lang->executionCommon}, then try again.";
$lang->project->notAllowRemoveProducts = "The story of this product is linked with the {$lang->executionCommon}. Unlink it before doing any action.";
$lang->project->errorNoLinkedProducts = "No {$lang->productCommon} is linked to {$lang->executionCommon}. You will be directed to {$lang->productCommon} page to link one.";
$lang->project->errorSameProducts = "{$lang->executionCommon} cannot be linked to the same {$lang->productCommon} twice.";
$lang->project->accessDenied = "Your access to {$lang->executionCommon} is denied!";
+1
View File
@@ -275,6 +275,7 @@ $lang->project->confirmUnlinkMember = "Voulez-vous retirer cet utilisateur
$lang->project->confirmUnlinkStory = "Voulez-vous retirer cette Story du {$lang->executionCommon} ?";
$lang->project->confirmUnlinkProjectStory = "Do you want to unlink this Story from the project?";
$lang->project->notAllowedUnlinkStory = "This {$lang->SRCommon} is linked to the {$lang->executionCommon} of the project. Remove it from the {$lang->executionCommon}, then try again.";
$lang->project->notAllowRemoveProducts = "The story of this product is linked with the {$lang->executionCommon}. Unlink it before doing any action.";
$lang->project->errorNoLinkedProducts = "Aucun {$lang->productCommon} n'est associé à ce {$lang->executionCommon}. Vous allez être redirigé vers la page {$lang->productCommon} pour en associer un.";
$lang->project->errorSameProducts = "Ce {$lang->executionCommon} ne peut pas être associé deux fois au même {$lang->productCommon}. Imaginez un peu les résultats !";
$lang->project->accessDenied = "Votre accès au {$lang->executionCommon} est refusé ! Désolé.";
+1
View File
@@ -275,6 +275,7 @@ $lang->project->confirmUnlinkMember = "Bạn có muốn hủy liên kết
$lang->project->confirmUnlinkStory = "Bạn có muốn hủy liên kết câu chuyện này từ {$lang->executionCommon}?";
$lang->project->confirmUnlinkProjectStory = "Do you want to unlink this Story from the project?";
$lang->project->notAllowedUnlinkStory = "This {$lang->SRCommon} is linked to the {$lang->executionCommon} of the project. Remove it from the {$lang->executionCommon}, then try again.";
$lang->project->notAllowRemoveProducts = "The story of this product is linked with the {$lang->executionCommon}. Unlink it before doing any action.";
$lang->project->errorNoLinkedProducts = "Không có {$lang->productCommon} liên kết tới {$lang->executionCommon}. Bạn sẽ được chuyển tới trang {$lang->productCommon} để liên kết.";
$lang->project->errorSameProducts = "{$lang->executionCommon} không thể liên kết tới {$lang->productCommon} giống nhau 2 lần.";
$lang->project->accessDenied = "Truy cập của bạn tới {$lang->executionCommon} bị từ chối!";
+1
View File
@@ -275,6 +275,7 @@ $lang->project->confirmUnlinkMember = "您确定从该{$lang->executionCom
$lang->project->confirmUnlinkStory = "您确定从该{$lang->executionCommon}中移除该{$lang->SRCommon}吗?";
$lang->project->confirmUnlinkProjectStory = "您确定从该项目中移除该{$lang->SRCommon}吗?";
$lang->project->notAllowedUnlinkStory = "该{$lang->SRCommon}已经与项目下{$lang->executionCommon}相关联,请从{$lang->executionCommon}中移除后再操作。";
$lang->project->notAllowRemoveProducts = "该产品中的需求已与该{$lang->executionCommon}进行了关联,请取消关联后再操作。";
$lang->project->errorNoLinkedProducts = "该{$lang->executionCommon}没有关联的{$lang->productCommon},系统将转到{$lang->productCommon}关联页面";
$lang->project->errorSameProducts = "{$lang->executionCommon}不能关联多个相同的{$lang->productCommon}。";
$lang->project->accessDenied = "您无权访问该{$lang->executionCommon}!";
+1
View File
@@ -269,6 +269,7 @@ $lang->project->confirmUnlinkMember = "您確定從該{$lang->executionCom
$lang->project->confirmUnlinkStory = "您確定從該{$lang->executionCommon}中移除該{$lang->SRCommon}嗎?";
$lang->project->confirmUnlinkProjectStory = "您確定從該項目中移除該{$lang->SRCommon}嗎?";
$lang->project->notAllowedUnlinkStory = "該{$lang->SRCommon}已經與項目下{$lang->executionCommon}相關聯,請從{$lang->executionCommon}中移除後再操作。";
$lang->project->notAllowRemoveProducts = "該產品中的需求已與該{$lang->executionCommon}進行了關聯,請取消關聯後再操作。";
$lang->project->errorNoLinkedProducts = "該{$lang->executionCommon}沒有關聯的{$lang->productCommon},系統將轉到{$lang->productCommon}關聯頁面";
$lang->project->errorSameProducts = "{$lang->executionCommon}不能關聯多個相同的{$lang->productCommon}。";
$lang->project->accessDenied = "您無權訪問該{$lang->executionCommon}!";
+2
View File
@@ -188,4 +188,6 @@
</div>
<?php js::set('weekend', $config->project->weekend);?>
<?php js::set('errorSameProducts', $lang->project->errorSameProducts);?>
<?php js::set('notRemoveProducts',$notRemoveProducts);?>
<?php js::set('tip', $lang->project->notAllowRemoveProducts);?>
<?php include '../../common/view/footer.html.php';?>
+5 -3
View File
@@ -25,11 +25,13 @@
<?php $class = $project->grade == 2 ? "disabled='disabled'" : '';?>
<?php foreach($allProducts as $productID => $productName):?>
<?php if(isset($linkedProducts[$productID])):?>
<?php $checked = 'checked';?>
<?php $isDisabled = in_array($productID, $notRemoveProducts) ? "disabled='disabled'" : '';?>
<?php $title = in_array($productID, $notRemoveProducts) ? $lang->project->notAllowRemoveProducts : $productName;?>
<?php $checked = 'checked';?>
<div class='col-sm-4'>
<div class='product <?php echo $checked . (isset($branchGroups[$productID]) ? ' has-branch' : '')?>'>
<div class="checkbox-primary" title='<?php echo $productName;?>'>
<?php echo "<input type='checkbox' name='products[$productID]' value='$productID' $checked $class id='products{$productID}'>";?>
<div class="checkbox-primary" title='<?php echo $title;?>'>
<?php echo "<input type='checkbox' name='products[$productID]' value='$productID' $checked $class id='products{$productID}' $isDisabled>";?>
<label class='text-ellipsis checkbox-inline' for='<?php echo 'products' . $productID;?>' title='<?php echo $productName;?>'><?php echo $productName;?></label>
</div>
<?php if(isset($branchGroups[$productID])) echo html::select("branch[$productID]", $branchGroups[$productID], $linkedProducts[$productID]->branch, "class='form-control chosen' $class");?>