This commit is contained in:
lanzongjun
2022-11-29 14:35:07 +08:00
parent 6356683483
commit 9077e9b4a3
6 changed files with 49 additions and 17 deletions
+16
View File
@@ -1972,6 +1972,22 @@ class baseSQL
return $this;
}
/**
* 创建FIND_IN_SET部分。
* Create the find_in_set by part.
*
* @param string $string
* @param string $field
* @access public
* @return static|sql the sql object.
*/
public function findInSet($string, $field)
{
if($this->inCondition and !$this->conditionIsTrue) return $this;
$this->sql .= "FIND_IN_SET(" . $this->quote($string) . ", $field)";
return $this;
}
/**
* 创建ORDER BY部分。
* Create the order by part.
+9
View File
@@ -4121,6 +4121,9 @@ class execution extends control
$count = 0;
if(!empty($planStory))
{
$projectProducts = $this->loadModel('project')->getBranchesByProject($executionID);
$projectProducts = zget($projectProducts, $productID, array());
foreach($planStory as $id => $story)
{
if($story->status == 'draft' or $story->status == 'reviewing')
@@ -4129,6 +4132,12 @@ class execution extends control
unset($planStory[$id]);
continue;
}
if(!empty($projectProducts) and !isset($projectProducts[$story->branch]))
{
$count++;
unset($planStory[$id]);
continue;
}
$planProducts[$story->id] = $story->product;
}
+8 -6
View File
@@ -4625,13 +4625,15 @@ class executionModel extends model
{
foreach($branches as $branchID => $branchName) $branchIdList[$branchID] = $branchID;
}
$plans = $this->dao->select('id,title,product,parent,begin,end')->from(TABLE_PRODUCTPLAN)
$query = $this->dao->select('id,title,product,parent,begin,end')->from(TABLE_PRODUCTPLAN)
->where('product')->in(array_keys($products))
->andWhere('deleted')->eq(0)
->andWhere('branch')->in($branchIdList)->fi()
->orderBy('begin desc')
->fetchAll('id');
->andWhere('deleted')->eq(0)->andWhere("FIND_IN_SET('', branch)", true);
foreach($branchIdList as $branchID)
{
$query->orWhere("FIND_IN_SET('$branchID', branch)");
}
$query->markRight(1)->orderBy('begin desc');
$plans = $query->fetchAll('id');
$plans = $this->productplan->reorder4Children($plans);
$productPlans = array();
+1 -1
View File
@@ -257,7 +257,7 @@ class product extends control
$this->products = $this->product->getProducts($projectID, 'all', '', false);
$projectProducts = $this->product->getProducts($projectID);
$productPlans = $this->execution->getPlans($projectProducts, 'skipParent');
$productPlans = $this->execution->getPlans($projectProducts, 'skipParent', $projectID);
if($browseType == 'bybranch') $param = $branchID;
$stories = $this->story->getExecutionStories($projectID, $productID, $branchID, $sort, $browseType, $param, $storyType, '', $pager);
+13 -9
View File
@@ -240,17 +240,19 @@ class productplanModel extends model
*/
public function getPairs($product = 0, $branch = '', $param = '', $skipParent = false)
{
$date = date('Y-m-d');
$plans = $this->dao->select('t1.id,t1.title,t1.parent,t1.begin,t1.end,t2.name as branchName,t3.type as productType')->from(TABLE_PRODUCTPLAN)->alias('t1')
$date = date('Y-m-d');
$query = $this->dao->select('t1.id,t1.title,t1.parent,t1.begin,t1.end,t2.name as branchName,t3.type as productType')->from(TABLE_PRODUCTPLAN)->alias('t1')
->leftJoin(TABLE_BRANCH)->alias('t2')->on('t2.id=t1.branch')
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t3.id=t1.product')
->where('t1.product')->in($product)
->andWhere('t1.deleted')->eq(0)
->beginIF($branch !== '' and $branch != 'all')->andWhere('t1.branch')->in("0,$branch")->fi()
->beginIF($branch !== '' and $branch != 'all')->andWhere("FIND_IN_SET('0', t1.branch)", true);
foreach(explode(',', $branch) as $branchIten) $query->orWhere("FIND_IN_SET('$branchIten', t1.branch)");
$query->markRight(1)->fi()
->beginIF(strpos($param, 'unexpired') !== false)->andWhere('t1.end')->ge($date)->fi()
->beginIF(strpos($param, 'noclosed') !== false)->andWhere('t1.status')->ne('closed')->fi()
->orderBy('t1.begin desc')
->fetchAll('id');
->orderBy('t1.begin desc');
$plans = $query->fetchAll('id');
$plans = $this->reorder4Children($plans);
$planPairs = array();
@@ -280,14 +282,16 @@ class productplanModel extends model
$date = date('Y-m-d');
$param = strtolower($param);
$branch = strpos($param, 'withmainplan') !== false ? "0,$branch" : $branch;
$plans = $this->dao->select('id,title,parent,begin,end')->from(TABLE_PRODUCTPLAN)
$query = $this->dao->select('id,title,parent,begin,end')->from(TABLE_PRODUCTPLAN)
->where('product')->in($product)
->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' and $branch !== '')->andWhere("branch")->in($branch)->fi()
->orderBy('begin desc')
->fetchAll('id');
->beginIF($branch !== 'all' and $branch !== '')->andWhere("FIND_IN_SET('0', branch)", true);
foreach(explode(',', $branch) as $branchIten) $query->orWhere("FIND_IN_SET('$branchIten', branch)");
$query->markRight(1)->fi()
->orderBy('begin desc');
$plans = $query->fetchAll('id');
$plans = $this->reorder4Children($plans);
$planPairs = array();
+2 -1
View File
@@ -1485,6 +1485,7 @@ class projectModel extends model
->setDefault('team', $this->post->name)
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', helper::now())
->setDefault('parent', 0)
->setIF($this->post->delta == 999, 'end', LONG_TIME)
->setIF($this->post->delta == 999, 'days', 0)
->setIF($this->post->begin == '0000-00-00', 'begin', '')
@@ -2339,7 +2340,7 @@ class projectModel extends model
$members = array_keys($this->getTeamMembers($projectID));
/* Link products of other programs. */
if($_POST['otherProducts'])
if(!empty($_POST['otherProducts']))
{
$products = array();
$otherProducts = $_POST['otherProducts'];