* Code for feedback #397.

This commit is contained in:
孙广明
2022-06-21 10:23:58 +08:00
parent 0f0fd55ba3
commit f0c23584e0
2 changed files with 12 additions and 19 deletions
+2 -5
View File
@@ -3984,18 +3984,15 @@ class executionModel extends model
->where('product')->in(array_keys($products))
->andWhere('deleted')->eq(0)
->andWhere('branch')->in($branchIdList)->fi()
->beginIF(strpos($param, 'skipparent') !== false)->andWhere('parent')->ne(-1)->fi()
->orderBy('begin desc')
->fetchAll('id');
$plans = $this->productplan->reorder4Children($plans);
$productPlans = array();
$parentTitle = array();
foreach($plans as $plan)
{
if($plan->parent == '-1') $parentTitle[$plan->id] = $plan->title;
if($plan->parent > 0 and isset($parentTitle[$plan->parent])) $plan->title = $parentTitle[$plan->parent] . ' /' . $plan->title;
if($plan->parent == '-1' and strpos($param, 'skipparent') !== false) continue;
if($plan->parent > 0 and isset($plans[$plan->parent])) $plan->title = $plans[$plan->parent]->title . ' /' . $plan->title;
$productPlans[$plan->product][$plan->id] = $plan->title . " [{$plan->begin} ~ {$plan->end}]";
if($plan->begin == '2030-01-01' and $plan->end == '2030-01-01') $productPlans[$plan->product][$plan->id] = $plan->title . ' ' . $this->lang->productplan->future;
}
+10 -14
View File
@@ -247,18 +247,13 @@ class productplanModel extends model
->orderBy('t1.begin desc')
->fetchAll('id');
$plans = $this->reorder4Children($plans);
$planPairs = array();
$parentTitle = array();
$plans = $this->reorder4Children($plans);
$planPairs = array();
$this->app->loadLang('branch');
foreach($plans as $plan)
{
if($plan->parent == '-1')
{
$parentTitle[$plan->id] = $plan->title;
if($skipParent) continue;
}
if($plan->parent > 0 and isset($parentTitle[$plan->parent])) $plan->title = $parentTitle[$plan->parent] . ' /' . $plan->title;
if($skipParent and $plan->parent == '-1') continue;
if($plan->parent > 0 and isset($plans[$plan->parent])) $plan->title = $plans[$plan->parent]->title . ' /' . $plan->title;
$planPairs[$plan->id] = $plan->title . " [{$plan->begin} ~ {$plan->end}]";
if($plan->begin == $this->config->productplan->future and $plan->end == $this->config->productplan->future) $planPairs[$plan->id] = $plan->title . ' ' . $this->lang->productplan->future;
if($plan->productType != 'normal') $planPairs[$plan->id] = ($plan->branchName ? $plan->branchName : $this->lang->branch->main) . ' / ' . $planPairs[$plan->id];
@@ -351,7 +346,6 @@ class productplanModel extends model
$plans = $this->dao->select('*')->from(TABLE_PRODUCTPLAN)
->where('deleted')->eq(0)
->beginIF($products)->andWhere('product')->in($products)->fi()
->beginIF(strpos($param, 'skipparent') !== false)->andWhere('parent')->ne(-1)->fi()
->beginIF(strpos($param, 'unexpired') !== false)->andWhere('end')->ge($date)->fi()
->orderBy($orderBy)
->fetchAll('id');
@@ -366,8 +360,8 @@ class productplanModel extends model
if($field == 'name')
{
if($plan->parent == '-1') $parentTitle[$plan->id] = $plan->title;
if($plan->parent > 0 and isset($parentTitle[$plan->parent])) $plan->title = $parentTitle[$plan->parent] . ' /' . $plan->title;
if($plan->parent == '-1' and strpos($param, 'skipparent') !== false) continue;
if($plan->parent > 0 and isset($plans[$plan->parent])) $plan->title = $plans[$plan->parent]->title . ' /' . $plan->title;
$planGroup[$plan->product][$plan->branch][$plan->id] = $plan->title . " [{$plan->begin} ~ {$plan->end}]";
if($plan->begin == $this->config->productplan->future and $plan->end == $this->config->productplan->future) $planGroup[$plan->product][$plan->branch][$plan->id] = $plan->title . ' ' . $this->lang->productplan->future;
}
@@ -419,17 +413,19 @@ class productplanModel extends model
*/
public function getBranchPlanPairs($productID, $branches = '', $skipParent = false)
{
$plans = $this->dao->select('branch,id,title,begin,end')->from(TABLE_PRODUCTPLAN)
$plans = $this->dao->select('parent,branch,id,title,begin,end')->from(TABLE_PRODUCTPLAN)
->where('product')->eq($productID)
->andWhere('deleted')->eq(0)
->beginIF($branches != '')->andWhere('branch')->in($branches)->fi()
->beginIF($skipParent)->andWhere('parent')->ne(-1)->fi()
->orderBy('begin desc')
->fetchAll('id');
$planPairs = array();
foreach($plans as $planID => $plan)
{
if($skipParent and $plan->parent == '-1') continue;
if($plan->parent > 0 and isset($plans[$plan->parent])) $plan->title = $plans[$plan->parent]->title . ' /' . $plan->title;
$planPairs[$plan->branch][$planID] = $plan->title . ' [' . $plan->begin . '~' . $plan->end . ']';
}
return $planPairs;