* [task#150565] Change the stage list.
This commit is contained in:
@@ -178,7 +178,7 @@ class programplanZen extends programplan
|
||||
$this->view->productList = $viewData->productList;
|
||||
$this->view->project = $viewData->project;
|
||||
$this->view->productID = $viewData->productID ?: key($viewData->productList);
|
||||
$this->view->stages = empty($viewData->planID) ? $this->loadModel('stage')->getStages('id_asc', 0, $viewData->project->model) : array();
|
||||
$this->view->stages = empty($viewData->planID) ? $this->loadModel('stage')->getStages('id_asc', 0, $viewData->project->workflowGroup) : array();
|
||||
$this->view->programPlan = $viewData->programPlan;
|
||||
$this->view->plans = $viewData->plans;
|
||||
$this->view->planID = $viewData->planID;
|
||||
|
||||
@@ -7,7 +7,6 @@ $config->stage->form = new stdclass();
|
||||
|
||||
$config->stage->form->create['name'] = array('type' => 'string', 'required' => true, 'default' => '', 'filter' => 'trim');
|
||||
$config->stage->form->create['type'] = array('type' => 'string', 'required' => true, 'default' => '');
|
||||
$config->stage->form->create['projectType'] = array('type' => 'string', 'required' => false, 'default' => '');
|
||||
$config->stage->form->create['createdBy'] = array('type' => 'string', 'required' => false, 'default' => $app->user->account);
|
||||
$config->stage->form->create['createdDate'] = array('type' => 'datetime', 'required' => false, 'default' => $now);
|
||||
if(isset($config->setPercent) && $config->setPercent == 1) $config->stage->form->create['percent'] = array('type' => 'float', 'required' => true, 'default' => 0);
|
||||
|
||||
@@ -18,59 +18,36 @@ class stage extends control
|
||||
*
|
||||
* @param int $groupID
|
||||
* @param string $orderBy
|
||||
* @param string $type waterfall|waterfallplus
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browse(int $groupID = 0, string $orderBy = "id_asc", string $type = 'waterfall')
|
||||
public function browse(int $groupID = 0, string $orderBy = "id_asc")
|
||||
{
|
||||
if($type == 'waterfallplus') $this->locate($this->createLink('stage', 'plusBrowse', "orderBy={$orderBy}&type=waterfallplus"));
|
||||
$workflowGroup = $this->loadModel('workflowgroup')->getByID($groupID);
|
||||
if($workflowGroup->projectModel == 'ipd') $this->config->stage->dtable->fieldList['type']['statusMap'] = $this->lang->stage->ipdTypeList;
|
||||
|
||||
$this->view->title = $this->lang->stage->common . $this->lang->hyphen . $this->lang->stage->browse;
|
||||
$this->view->stages = $this->stage->getStages($orderBy, 0, $type);
|
||||
$this->view->stages = $this->stage->getStages($orderBy, 0, $groupID);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->type = $type;
|
||||
$this->view->groupID = $groupID;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* 融合瀑布模型阶段列表页。
|
||||
* Waterfall plus model stage list page.
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @param string $type waterfall|waterfallplus
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function plusBrowse($orderBy = "id_asc", $type = 'waterfallplus')
|
||||
{
|
||||
if($type == 'waterfall') $this->locate($this->createLink('stage', 'browse', "orderBy={$orderBy}&type=waterfall"));
|
||||
|
||||
$this->view->stages = $this->stage->getStages($orderBy, 0, $type);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->type = $type;
|
||||
$this->view->title = $this->lang->stage->common . $this->lang->hyphen . $this->lang->stage->browse;
|
||||
|
||||
$this->display('stage', 'browse');
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一个阶段。
|
||||
* Create a stage.
|
||||
*
|
||||
* @param int $groupID
|
||||
* @param string $type waterfall|waterfallplus
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create(int $groupID = 0, string $type = 'waterfall')
|
||||
public function create(int $groupID = 0)
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$stageData = form::data()->setDefault('projectType', $type)->get();
|
||||
$stageID = $this->stage->create($stageData, $type);
|
||||
$stageData = form::data()->setDefault('workflowGroup', $groupID)->get();
|
||||
$stageID = $this->stage->create($stageData);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
$this->loadModel('action')->create('stage', $stageID, 'Opened');
|
||||
@@ -79,6 +56,7 @@ class stage extends control
|
||||
|
||||
$this->view->title = $this->lang->stage->common . $this->lang->hyphen . $this->lang->stage->create;
|
||||
$this->view->groupID = $groupID;
|
||||
$this->view->flow = $this->loadModel('workflowgroup')->getByID($groupID);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
+8
-17
@@ -18,16 +18,15 @@ class stageModel extends model
|
||||
* 创建一个阶段。
|
||||
* Create a stage.
|
||||
*
|
||||
* @param object $stage
|
||||
* @param string $type waterfall|waterfallplus
|
||||
* @param object $stage
|
||||
* @access public
|
||||
* @return int|bool
|
||||
*/
|
||||
public function create(object $stage, string $type = 'waterfall'): int|bool
|
||||
public function create(object $stage): int|bool
|
||||
{
|
||||
if(isset($this->config->setPercent) && $this->config->setPercent == 1)
|
||||
{
|
||||
$totalPercent = $this->getTotalPercent($type);
|
||||
$totalPercent = $this->getTotalPercent($stage->workflowGroup);
|
||||
|
||||
if(!is_numeric($stage->percent))
|
||||
{
|
||||
@@ -144,11 +143,11 @@ class stageModel extends model
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @param int $projectID
|
||||
* @param string $type
|
||||
* @param int $groupID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStages(string $orderBy = 'id_desc', int $projectID = 0, string $type = ''): array
|
||||
public function getStages(string $orderBy = 'id_desc', int $projectID = 0, int $groupID = 0): array
|
||||
{
|
||||
if(common::isTutorialMode()) return $this->loadModel('tutorial')->getStages();
|
||||
|
||||
@@ -165,17 +164,9 @@ class stageModel extends model
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
$stageType = '';
|
||||
if($this->config->systemMode == 'PLM' && $this->app->rawMethod == 'create' && $this->app->rawModule == 'programplan' && $type == 'ipd')
|
||||
{
|
||||
$project = $this->loadModel('project')->fetchByID($this->session->project);
|
||||
$stageType = zget($this->config->project->categoryStages, $project->category, '');
|
||||
}
|
||||
|
||||
return $this->dao->select('*')->from(TABLE_STAGE)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('projectType')->eq($type)
|
||||
->beginIF(!empty($stageType))->andWhere('type')->in($stageType)->fi()
|
||||
->andWhere('workflowGroup')->eq($groupID)
|
||||
->orderBy($orderBy)
|
||||
->fetchAll('id');
|
||||
}
|
||||
@@ -200,8 +191,8 @@ class stageModel extends model
|
||||
* @param string $type waterfall|waterfallplus
|
||||
* @return float
|
||||
*/
|
||||
public function getTotalPercent(string $type): float
|
||||
public function getTotalPercent(int $groupID): float
|
||||
{
|
||||
return (float)$this->dao->select('sum(percent) as total')->from(TABLE_STAGE)->where('deleted')->eq('0')->andWhere('projectType')->eq($type)->fetch('total');
|
||||
return (float)$this->dao->select('sum(percent) as total')->from(TABLE_STAGE)->where('deleted')->eq('0')->andWhere('workflowGroup')->eq($groupID)->fetch('total');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ featureBar();
|
||||
|
||||
$canCreateStage = hasPriv('stage', 'create');
|
||||
$canbatchCreateStage = hasPriv('stage', 'batchCreate');
|
||||
if($canCreateStage) $createItem = array('icon' => 'plus', 'class' => 'primary', 'text' => $lang->stage->create, 'url' => $this->createLink('stage', 'create', "groupID={$groupID}&type={$type}"), 'data-toggle' => 'modal');
|
||||
if($canbatchCreateStage) $batchCreateItem = array('icon' => 'plus', 'class' => 'primary mr-4', 'text' => $lang->stage->batchCreate, 'url' => $this->createLink('stage', 'batchCreate', "groupID={$groupID}&type={$type}"));
|
||||
if($canCreateStage) $createItem = array('icon' => 'plus', 'class' => 'primary', 'text' => $lang->stage->create, 'url' => $this->createLink('stage', 'create', "groupID={$groupID}"), 'data-toggle' => 'modal');
|
||||
if($canbatchCreateStage) $batchCreateItem = array('icon' => 'plus', 'class' => 'primary mr-4', 'text' => $lang->stage->batchCreate, 'url' => $this->createLink('stage', 'batchCreate', "groupID={$groupID}"));
|
||||
toolbar
|
||||
(
|
||||
!empty($batchCreateItem) ? item(set($batchCreateItem)) : null,
|
||||
@@ -28,5 +28,5 @@ dtable
|
||||
set::cols($config->stage->dtable->fieldList),
|
||||
set::data($tableData),
|
||||
set::orderBy($orderBy),
|
||||
set::sortLink(createLink('stage', 'browse', "orderBy={name}_{sortType}&type={$type}"))
|
||||
set::sortLink(createLink('stage', 'browse', "groupID={$groupID}&orderBy={name}_{sortType}"))
|
||||
);
|
||||
|
||||
@@ -53,7 +53,7 @@ formPanel
|
||||
set::width('1/2'),
|
||||
set::label($lang->stage->type),
|
||||
set::name('type'),
|
||||
set::items($lang->stage->typeList)
|
||||
set::items($flow->projectModel == 'ipd' ? $lang->stage->ipdTypeList : $lang->stage->typeList)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user