* Finish task #45823.

This commit is contained in:
liumengyi
2021-12-09 14:27:21 +08:00
parent 76d0034f59
commit 840082e4c1
7 changed files with 109 additions and 3 deletions
+1
View File
@@ -36,6 +36,7 @@ $config->action->objectNameFields['mr'] = 'title';
$config->action->objectNameFields['kanbancolumn'] = 'name';
$config->action->objectNameFields['kanbanlane'] = 'name';
$config->action->objectNameFields['kanbanspace'] = 'name';
$config->action->objectNameFields['kanban'] = 'name';
$config->action->commonImgSize = 870;
+1
View File
@@ -542,6 +542,7 @@ $lang->action->label->design = 'Design|design|view|designID=%s';
$lang->action->label->stakeholder = 'Stakeholder|stakeholder|view|userID=%s';
$lang->action->label->api = 'Interface|api|index|libID=%s&moduleID=%s&apiID=%s';
$lang->action->label->kanbanspace = 'Kanban Space|kanban|space|browseType=all';
$lang->action->label->kanban = 'Kanban|kanban|view|kanbanID=%s';
$lang->action->label->kanbancolumn = 'Kanban Column|execution|kanban|execution=%s';
$lang->action->label->kanbanlane = 'Kanban Lane|execution|kanban|execution=%s&type=all';
$lang->action->label->mr = 'Merge Request|mr|view|id=%s';
+1
View File
@@ -542,6 +542,7 @@ $lang->action->label->design = '设计|design|view|designID=%s';
$lang->action->label->stakeholder = '干系人|stakeholder|view|userID=%s';
$lang->action->label->api = '接口|api|index|libID=%s&moduleID=%s&apiID=%s';
$lang->action->label->kanbanspace = '看板空间|kanban|space|browseType=all';
$lang->action->label->kanban = '看板|kanban|view|kanbanID=%s';
$lang->action->label->kanbancolumn = '看板列|execution|kanban|execution=%s';
$lang->action->label->kanbanlane = '看板泳道|execution|kanban|execution=%s&type=all';
$lang->action->label->mr = '合并请求|mr|view|id=%s';
+3
View File
@@ -7,16 +7,19 @@ $config->kanban->setlane = new stdclass();
$config->kanban->setlaneColumn = new stdclass();
$config->kanban->createspace = new stdclass();
$config->kanban->editspace = new stdclass();
$config->kanban->close = new stdclass();
$config->kanban->setwip->requiredFields = 'limit';
$config->kanban->setlane->requiredFields = 'name,type';
$config->kanban->setlaneColumn->requiredFields = 'name';
$config->kanban->createspace->requiredFields = 'name,owner';
$config->kanban->editspace->requiredFields = 'name,owner';
$config->kanban->close->requiredFields = 'comment';
$config->kanban->editor = new stdclass();
$config->kanban->editor->createspace = array('id' => 'desc', 'tools' => 'simpleTools');
$config->kanban->editor->editspace = array('id' => 'desc', 'tools' => 'simpleTools');
$config->kanban->editor->close = array('id' => 'comment', 'tools' => 'simpleTools');
$config->kanban->default = new stdclass();
$config->kanban->default->story = new stdclass();
+32 -2
View File
@@ -49,7 +49,7 @@ class kanban extends control
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action')->create('kanbanSpace', $spaceID, 'created');
die(js::closeModal('parent.parent', 'this', "function(){parent.parent.location.reload();}"));
die(js::reload('parent.parent'));
}
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
@@ -75,7 +75,7 @@ class kanban extends control
$actionID = $this->loadModel('action')->create('kanbanSpace', $spaceID, 'edited');
$this->action->logHistory($actionID, $changes);
die(js::closeModal('parent.parent', 'this', "function(){parent.parent.location.reload();}"));
die(js::reload('parent.parent'));
}
$this->view->space = $this->kanban->getSpaceById($spaceID);
@@ -84,6 +84,36 @@ class kanban extends control
$this->display();
}
/**
* Close a kanban.
*
* @param int $kanbanID
* @access public
* @return void
*/
public function close($kanbanID)
{
$this->loadModel('action');
if(!empty($_POST))
{
$changes = $this->kanban->close($kanbanID);
if(dao::isError()) die(js::error(dao::getError()));
$actionID = $this->action->create('kanban', $kanbanID, 'closed', $this->post->comment);
$this->action->logHistory($actionID, $changes);
die(js::reload('parent.parent'));
}
$this->view->kanban = $this->kanban->getById($kanbanID);
$this->view->actions = $this->action->getList('kanban', $kanbanID);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
}
/**
* Set WIP.
*
+31 -1
View File
@@ -179,7 +179,7 @@ class kanbanModel extends model
public function updateSpace($spaceID)
{
$spaceID = (int)$spaceID;
$oldSpace = $this->dao->findById($spaceID)->from(TABLE_KANBANSPACE)->fetch();
$oldSpace = $this->getSpaceById($spaceID);
$space = fixer::input('post')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', helper::now())
@@ -197,6 +197,36 @@ class kanbanModel extends model
if(!dao::isError()) return common::createChanges($oldSpace, $space);
}
/**
* Close a kanban.
*
* @param int $kanbanID
* @access public
* @return array
*/
function close($kanbanID)
{
$kanbanID = (int)$kanbanID;
$oldKanban = $this->getById($kanbanID);
$now = helper::now();
$kanban = fixer::input('post')
->setDefault('status', 'closed')
->setDefault('closedBy', $this->app->user->account)
->setDefault('closedDate', $now)
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->remove('comment')
->get();
$this->dao->update(TABLE_KANBAN)->data($kanban)
->autoCheck()
->check($this->config->kanban->close->requiredFields,'notempty')
->where('id')->eq($kanbanID)
->exec();
if(!dao::isError()) return common::createChanges($oldKanban, $kanban);
}
/**
* Add execution Kanban lanes and columns.
*
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* The close file of kanban module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Mengyi Liu <fujia@cnezsoft.com>
* @package kanban
* @version $Id: close.html.php 935 2021-12-09 10:49:24Z $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
<h2>
<span class='label label-id'><?php echo $kanban->id;?></span>
<?php echo "<span title='$kanban->name'>" . $kanban->name . '</span>';?>
</div>
</div>
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->comment;?></th>
<td colspan='2'><?php echo html::textarea('comment', '', "rows='6' class='w-p98'");?></td>
</tr>
<tr>
<td colspan='3' class='text-center form-actions'>
<?php echo html::submitButton($lang->kanban->close);?>
</td>
</tr>
</table>
</form>
<hr class='small' />
<div class='main'><?php include '../../common/view/action.html.php';?></div>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>