* Refactor, suspend execution page.

This commit is contained in:
tianshujie
2023-06-19 09:40:05 +08:00
parent 7d33f83356
commit 09a31edb96
2 changed files with 56 additions and 10 deletions
+7 -10
View File
@@ -2283,7 +2283,7 @@ class execution extends control
* @access public
* @return void
*/
public function suspend($executionID, $from = 'execution')
public function suspend(int $executionID, string $from = 'execution')
{
$execution = $this->commonAction($executionID);
$executionID = $execution->id;
@@ -2294,7 +2294,7 @@ class execution extends control
$this->loadModel('action');
$this->execution->computeBurn($executionID);
$changes = $this->execution->suspend($executionID);
if(dao::isError()) return print(js::error(dao::getError()));
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($this->post->comment != '' or !empty($changes))
{
@@ -2306,14 +2306,11 @@ class execution extends control
if($project->model == 'waterfall' or $project->model == 'waterfallplus') $this->loadModel('programplan')->computeProgress($executionID, 'suspend');
$this->executeHooks($executionID);
if(isonlybody() and $from == 'kanban')
{
return print(js::closeModal('parent.parent', '', "parent.parent.changeStatus('suspended')"));
}
else
{
return print(js::reload('parent.parent'));
}
$response['closeModal'] = true;
$response['load'] = true;
if($from == 'kanban') $response['callback'] = "changeStatus('doing')";
return $this->sendSuccess($response);
}
$this->view->title = $this->view->execution->name . $this->lang->colon .$this->lang->execution->suspend;
+49
View File
@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
/**
* The suspend view file of execution module of ZenTaoPMS.
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Shujie Tian<tianshujie@easycorp.ltd>
* @package execution
* @link https://www.zentao.net
*/
namespace zin;
$space = common::checkNotCN() ? ' ' : '';
formPanel
(
set::title($lang->execution->suspend . $space . $lang->executionCommon),
set::headingClass('status-heading'),
set::titleClass('form-label .form-grid'),
set::shadow(false),
set::actions(array('submit')),
set::submitBtnText($lang->execution->suspend . $space . $lang->executionCommon),
to::headingActions
(
entityLabel
(
setClass('my-3 gap-x-3'),
set::level(1),
set::text($execution->name),
set::entityID($execution->id),
set::reverse(true),
)
),
formGroup
(
set::label($lang->comment),
editor
(
set::name('comment'),
set::rows('6'),
)
),
);
h::hr(set::class('mt-6'));
history();
/* ====== Render page ====== */
render('modalDialog');