* Finish task #8226.

This commit is contained in:
holan20180123
2020-11-09 09:53:18 +08:00
parent 7c04c8bdb8
commit dca05f8be2
5 changed files with 16 additions and 10 deletions
+1 -1
View File
@@ -211,7 +211,7 @@ class product extends control
$this->view->productName = $this->products[$productID];
$this->view->moduleID = $moduleID;
$this->view->stories = $stories;
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, $branch);
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, $branch, '', true);
$this->view->summary = $this->product->summary($stories, $storyType);
$this->view->moduleTree = $moduleTree;
$this->view->parentModules = $this->tree->getParents($moduleID);
+8 -2
View File
@@ -157,10 +157,11 @@ class productplanModel extends model
* @param array|int $product
* @param int $branch
* @param string $expired
* @param bool $skipParent
* @access public
* @return array
*/
public function getPairs($product = 0, $branch = 0, $expired = '')
public function getPairs($product = 0, $branch = 0, $expired = '', $skipParent = false)
{
$date = date('Y-m-d');
$plans = $this->dao->select('id,title,parent,begin,end')->from(TABLE_PRODUCTPLAN)
@@ -168,6 +169,7 @@ class productplanModel extends model
->andWhere('deleted')->eq(0)
->beginIF($branch)->andWhere("branch")->in("0,$branch")->fi()
->beginIF($expired == 'unexpired')->andWhere('end')->ge($date)->fi()
->beginIF($skipParent)->andWhere('parent')->ne(-1)->fi()
->orderBy('begin desc')
->fetchAll('id');
@@ -179,6 +181,7 @@ class productplanModel extends model
->andWhere('end')->lt($date)
->beginIF($branch)->andWhere("branch")->in("0,$branch")->fi()
->beginIF($plans)->andWhere("id")->notIN(array_keys($plans))->fi()
->beginIF($skipParent)->andWhere('parent')->ne(-1)->fi()
->orderBy('begin desc')
->limit(5)
->fetchAll('id');
@@ -207,10 +210,11 @@ class productplanModel extends model
*
* @param array|int $product
* @param int $branch
* @param bool $skipParent
* @access public
* @return array
*/
public function getPairsForStory($product = 0, $branch = 0)
public function getPairsForStory($product = 0, $branch = 0, $skipParent = false)
{
$date = date('Y-m-d');
$plans = $this->dao->select('id,title,parent,begin,end')->from(TABLE_PRODUCTPLAN)
@@ -218,6 +222,7 @@ class productplanModel extends model
->andWhere('deleted')->eq(0)
->andWhere('end')->ge($date)
->beginIF($branch)->andWhere("branch")->in("0,$branch")->fi()
->beginIF($skipParent)->andWhere('parent')->ne(-1)->fi()
->orderBy('begin desc')
->fetchAll('id');
@@ -228,6 +233,7 @@ class productplanModel extends model
->andWhere('deleted')->eq(0)
->andWhere('end')->lt($date)
->beginIF($branch)->andWhere("branch")->in("0,$branch")->fi()
->beginIF($skipParent)->andWhere('parent')->ne(-1)->fi()
->orderBy('begin desc')
->limit(5)
->fetchAll('id');
+1 -1
View File
@@ -126,7 +126,7 @@
<td class='c-actions'>
<?php
if(common::hasPriv('project', 'create', $plan)) echo html::a(helper::createLink('project', 'create', "productID=&projectID=&copyProjectID=&planID=$plan->id"), '<i class="icon-plus"></i>', '', "class='btn' title='{$lang->project->create}'");
if(common::hasPriv('productplan', 'linkStory', $plan)) echo html::a(inlink('view', "planID=$plan->id&type=story&orderBy=id_desc&link=true"), '<i class="icon-link"></i>', '', "class='btn' title='{$lang->productplan->linkStory}'");
if(common::hasPriv('productplan', 'linkStory', $plan) and $plan->parent >= 0) echo html::a(inlink('view', "planID=$plan->id&type=story&orderBy=id_desc&link=true"), '<i class="icon-link"></i>', '', "class='btn' title='{$lang->productplan->linkStory}'");
if(common::hasPriv('productplan', 'linkBug', $plan) and $config->global->flow != 'onlyStory') echo html::a(inlink('view', "planID=$plan->id&type=bug&orderBy=id_desc&link=true"), '<i class="icon-bug"></i>', '', "class='btn' title='{$lang->productplan->linkBug}'");
common::printIcon('productplan', 'edit', "planID=$plan->id", $plan, 'list');
if(common::hasPriv('productplan', 'create', $plan))
+2 -2
View File
@@ -62,7 +62,7 @@
<div id='stories' class='tab-pane <?php if($type == 'story') echo 'active'?>'>
<?php $canOrder = common::hasPriv('project', 'storySort');?>
<div class='actions'>
<?php if(!$plan->deleted):?>
<?php if(!$plan->deleted and $plan->parent >= 0):?>
<div class="btn-group">
<div class='drop-down dropdown-hover'>
<?php
@@ -82,7 +82,7 @@
</div>
</div>
<?php endif;?>
<?php if(common::hasPriv('productplan', 'linkStory')) echo html::a("javascript:showLink($plan->id, \"story\")", '<i class="icon-link"></i> ' . $lang->productplan->linkStory, '', "class='btn btn-primary'");?>
<?php if(common::hasPriv('productplan', 'linkStory') and $plan->parent >= 0) echo html::a("javascript:showLink($plan->id, \"story\")", '<i class="icon-link"></i> ' . $lang->productplan->linkStory, '', "class='btn btn-primary'");?>
</div>
<?php if(common::hasPriv('productplan', 'linkStory')):?>
<div class='linkBox cell hidden'></div>
+4 -4
View File
@@ -256,7 +256,7 @@ class story extends control
$this->view->users = $users;
$this->view->moduleID = $moduleID ? $moduleID : (int)$this->cookie->lastStoryModule;
$this->view->moduleOptionMenu = $moduleOptionMenu;
$this->view->plans = $this->loadModel('productplan')->getPairsForStory($productID, $branch);
$this->view->plans = $this->loadModel('productplan')->getPairsForStory($productID, $branch, true);
$this->view->planID = $planID;
$this->view->source = $source;
$this->view->sourceNote = $sourceNote;
@@ -367,7 +367,7 @@ class story extends control
}
$moduleOptionMenu['ditto'] = $this->lang->story->ditto;
$plans = $this->loadModel('productplan')->getPairsForStory($productID, $branch);
$plans = $this->loadModel('productplan')->getPairsForStory($productID, $branch, true);
$plans['ditto'] = $this->lang->story->ditto;
$priList = (array)$this->lang->story->priList;
$priList['ditto'] = $this->lang->story->ditto;
@@ -442,7 +442,7 @@ class story extends control
$this->view->products = $products;
$this->view->story = $story;
$this->view->moduleOptionMenu = $moduleOptionMenu;
$this->view->plans = $this->loadModel('productplan')->getPairs($product->id);
$this->view->plans = $this->loadModel('productplan')->getPairs($product->id, 0, '', true);
$this->view->actions = $this->action->getList('story', $storyID);
}
@@ -542,7 +542,7 @@ class story extends control
/* Set modules and productPlans. */
$modules = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch);
$modules = array('ditto' => $this->lang->story->ditto) + $modules;
$productPlans = $this->productplan->getPairs($productID, $branch);
$productPlans = $this->productplan->getPairs($productID, $branch, '', true);
$productPlans = array('' => '', 'ditto' => $this->lang->story->ditto) + $productPlans;