This commit is contained in:
Catouse
2018-07-05 14:20:07 +08:00
4 changed files with 56 additions and 5 deletions
+52 -1
View File
@@ -108,6 +108,7 @@ class productplanModel extends model
* Get plan pairs.
*
* @param array|int $product
* @param int $branch
* @param string $expired
* @access public
* @return array
@@ -140,7 +141,41 @@ class productplanModel extends model
{
$plans[$key] = str_replace('[2030-01-01 ~ 2030-01-01]', '[' . $this->lang->productplan->future . ']', $value);
}
return array('' => '') + $plans;
return array('' => '') + $this->processFuture($plans);
}
/**
* Get plan pairs for story.
*
* @param array|int $product
* @param int $branch
* @access public
* @return array
*/
public function getPairsForStory($product = 0, $branch = 0)
{
$date = date('Y-m-d');
$plans = $this->dao->select('id, CONCAT(title, " [", begin, " ~ ", end, "]") AS title')->from(TABLE_PRODUCTPLAN)
->where('product')->in($product)
->andWhere('deleted')->eq(0)
->andWhere('end')->ge($date)
->beginIF($branch)->andWhere("branch")->in("0,$branch")->fi()
->orderBy('begin desc')
->fetchPairs();
if(!$plans)
{
$plans = $this->dao->select('id, CONCAT(title, " [", begin, " ~ ", end, "]") AS title')->from(TABLE_PRODUCTPLAN)
->where('product')->in($product)
->andWhere('deleted')->eq(0)
->andWhere('end')->lt($date)
->beginIF($branch)->andWhere("branch")->in("0,$branch")->fi()
->orderBy('begin desc')
->limit(5)
->fetchPairs();
}
return array('' => '') + $this->processFuture($plans);
}
/**
@@ -369,4 +404,20 @@ class productplanModel extends model
$this->dao->update(TABLE_BUG)->set('plan')->eq(0)->where('id')->eq((int)$bugID)->exec();
$this->loadModel('action')->create('bug', $bugID, 'unlinkedfromplan', '', $planID);
}
/**
* Process future of plans.
*
* @param array $plans
* @access public
* @return array
*/
public function processFuture($plans)
{
foreach($plans as $key => $value)
{
$plans[$key] = str_replace('[2030-01-01 ~ 2030-01-01]', '[' . $this->lang->productplan->future . ']', $value);
}
return $plans;
}
}
+1 -1
View File
@@ -99,7 +99,7 @@
if(common::hasPriv('productplan', 'delete', $plan))
{
$deleteURL = $this->createLink('productplan', 'delete', "planID=$plan->id&confirm=yes");
echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"productplan\",confirmDelete)", '<i class="icon-trash"></i>', '', "class='btn btn-icon' title='{$lang->productplan->delete}'");
echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"productplanList\",confirmDelete)", '<i class="icon-trash"></i>', '', "class='btn btn-icon' title='{$lang->productplan->delete}'");
}
?>
</td>
+2 -2
View File
@@ -238,7 +238,7 @@ class story extends control
$this->view->users = $users;
$this->view->moduleID = $moduleID;
$this->view->moduleOptionMenu = $moduleOptionMenu;
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, $branch, 'unexpired');
$this->view->plans = $this->loadModel('productplan')->getPairsForStory($productID, $branch);
$this->view->planID = $planID;
$this->view->source = $source;
$this->view->sourceNote = $sourceNote;
@@ -327,7 +327,7 @@ class story extends control
}
$moduleOptionMenu['ditto'] = $this->lang->story->ditto;
$plans = $this->loadModel('productplan')->getPairs($productID, $branch, 'unexpired');
$plans = $this->loadModel('productplan')->getPairsForStory($productID, $branch);
$plans['ditto'] = $this->lang->story->ditto;
$priList = (array)$this->lang->story->priList;
$priList['ditto'] = $this->lang->story->ditto;
+1 -1
View File
@@ -337,7 +337,7 @@ function ajaxDelete(url, replaceID, notice)
$('#' + replaceID).html($(data).find('#' + replaceID).html());
if(typeof sortTable == 'function') sortTable();
$('#' + replaceID).find('[data-toggle=modal], a.iframe').modalTrigger();
$('#' + replaceID).find('table.datatable').datatable();
if($('#' + replaceID).find('table.datatable').length) $('#' + replaceID).find('table.datatable').datatable();
});
}
}