Merge branch 'mayue_fix_bug#21706' into 'master'

* Fix bug #21706.

See merge request easycorp/zentaopms!3088
This commit is contained in:
孙广明
2022-04-22 08:10:56 +00:00
5 changed files with 20 additions and 12 deletions
+5 -3
View File
@@ -1009,10 +1009,12 @@ class product extends control
public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $fieldID = '', $needCreate = false, $expired = '', $param = '')
{
$param = strtolower($param);
$plans = $this->loadModel('productplan')->getPairs($productID, $branch, $expired, strpos($param, 'skipparent') !== false);
$plans = $this->loadModel('productplan')->getPairs($productID, $branch == 0 ? '' : $branch, $expired, strpos($param, 'skipparent') !== false);
$field = $fieldID ? "plans[$fieldID]" : 'plan';
$output = '';
$output .= html::select($field, $plans, $planID, "class='form-control chosen'");
$output = html::select($field, $plans, $planID, "class='form-control chosen'");
if($branch == 0 and strpos($param, 'edit')) $output = html::select($field, $plans, $planID, "class='form-control chosen' multiple");
if(count($plans) == 1 and $needCreate and $needCreate !== 'false')
{
$output .= "<div class='input-group-btn'>";
+10 -4
View File
@@ -238,7 +238,7 @@ class productplanModel extends model
->andWhere('deleted')->eq(0)
->beginIF(strpos($param, 'unexpired') !== false)->andWhere('end')->ge($date)->fi()
->beginIF(strpos($param, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi()
->beginIF($branch !== 'all' or $branch !== '')->andWhere("branch")->in($branch)->fi()
->beginIF($branch !== 'all' and $branch !== '')->andWhere("branch")->in($branch)->fi()
->orderBy('begin desc')
->fetchAll('id');
@@ -375,7 +375,7 @@ class productplanModel extends model
$plans = $this->dao->select('branch,id,title,begin,end')->from(TABLE_PRODUCTPLAN)
->where('product')->eq($productID)
->andWhere('deleted')->eq(0)
->beginIF(!empty($branches))->andWhere('branch')->in($branches)->fi()
->beginIF($branches != '')->andWhere('branch')->in($branches)->fi()
->beginIF($skipParent)->andWhere('parent')->ne(-1)->fi()
->fetchAll('id');
@@ -846,9 +846,15 @@ class productplanModel extends model
}
else
{
$plansOfStory = $story->plan . ',' . $planID;
$branchPlanPairs = $this->dao->select('branch, id as plan')->from(TABLE_PRODUCTPLAN)
->where('product')->eq($story->product)
->andWhere('id')->in($story->plan)
->fetchPairs();
if(isset($branchPlanPairs[$plan->branch])) $branchPlanPairs[$plan->branch] = $planID;
$this->dao->update(TABLE_STORY)->set("plan")->eq($plansOfStory)->where('id')->eq((int)$storyID)->andWhere('branch')->eq('0')->exec();
$plansOfStory = ',' . implode(',', $branchPlanPairs);
$this->dao->update(TABLE_STORY)->set("plan")->eq($plansOfStory)->where('id')->eq((int)$storyID)->exec();
$this->story->updateStoryOrderOfPlan($storyID, $planID);
}
+3 -3
View File
@@ -151,9 +151,9 @@
<th class='c-id text-left'>
<?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?>
</th>
<th class='w-70px' title='<?php echo $lang->pri;?>'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th class='text-left'><?php common::printOrderLink('title', $orderBy, $vars, $lang->story->title);?></th>
<th class='w-70px'> <?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
<th class='w-70px' title='<?php echo $lang->pri;?>'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th class='text-left'><?php common::printOrderLink('title', $orderBy, $vars, $lang->story->title);?></th>
<th class='w-70px'> <?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
<?php else:?>
<th class='c-id text-left'>
<?php if($planStories && $canBatchAction):?>
+1 -1
View File
@@ -757,7 +757,7 @@ class story extends control
$this->view->stories = $stories;
$this->view->users = $users;
$this->view->product = $product;
$this->view->plans = $this->loadModel('productplan')->getPairsForStory($story->product, $story->branch, 'skipParent');
$this->view->plans = $this->loadModel('productplan')->getPairsForStory($story->product, $story->branch == 0 ? 'all' : $story->branch, 'skipParent');
$this->view->products = $products;
$this->view->branchOption = $branchOption;
$this->view->branchTagOption = $branchTagOption;
+1 -1
View File
@@ -127,7 +127,7 @@ function loadProductPlans(productID, branch)
if(typeof(branch) == 'undefined') branch = 0;
if(!branch) branch = 0;
var expired = config.currentMethod == 'create' ? 'unexpired' : '';
planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=' + branch + '&planID=' + $('#plan').val() + '&fieldID=&needCreate=true&expired='+ expired +'&param=skipParent');
planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=' + branch + '&planID=' + $('#plan').val() + '&fieldID=&needCreate=true&expired='+ expired +'&param=skipParent,' + config.currentMethod);
var $planIdBox = $('#planIdBox');
$planIdBox.load(planLink, function()
{