Merge branch 'sprint/179_liumengyi_46150' into 'kanban'

* Finish task #46150.

See merge request easycorp/zentaopms!964
This commit is contained in:
孙广明
2021-12-16 00:41:42 +00:00
6 changed files with 110 additions and 5 deletions
+3 -3
View File
@@ -15,8 +15,8 @@ $config->kanban->edit = new stdclass();
$config->kanban->createspace = new stdclass();
$config->kanban->editspace = new stdclass();
$config->kanban->createcard = new stdclass();
$config->kanban->editcard = new stdclass();
$config->kanban->editregion = new stdclass();
$config->kanban->setwip->requiredFields = 'limit';
$config->kanban->setlane->requiredFields = 'name,type';
@@ -26,8 +26,8 @@ $config->kanban->edit->requiredFields = 'space,name';
$config->kanban->createspace->requiredFields = 'name,owner';
$config->kanban->editspace->requiredFields = 'name,owner';
$config->kanban->createcard->requiredFields = 'name';
$config->kanban->editcard->requiredFields = 'name';
$config->kanban->editcard->requiredFields = 'name';
$config->kanban->editregion->requiredFields = 'name';
$config->kanban->editor = new stdclass();
$config->kanban->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
+27
View File
@@ -287,6 +287,33 @@ class kanban extends control
}
}
/**
* Edit a region
*
* @param int $regionID
* @access public
* @return void
*/
public function editRegion($regionID = 0)
{
$this->loadModel('action');
if(!empty($_POST))
{
$changes = $this->kanban->updateRegion($regionID);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$actionID = $this->action->create('kanbanregion', $regionID, 'edited');
$this->action->logHistory($actionID, $changes);
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
$this->view->region = $this->kanban->getRegionByID($regionID);
$this->display();
}
/**
* Delete a region
*
+1 -1
View File
@@ -223,7 +223,7 @@ $lang->kanbanlane->modeList['sameAsOther'] = 'Use the same Kanban column as othe
$lang->kanbanlane->modeList['independent'] = 'Independent Kanban column is adopted';
$lang->kanbanregion = new stdclass();
$lang->kanbanregion->name = 'Kanban Region';
$lang->kanbanregion->name = 'Region Name';
$lang->kanbanregion->default = 'Default Region';
$lang->kanbancard = new stdclass();
+1 -1
View File
@@ -223,7 +223,7 @@ $lang->kanbanlane->modeList['sameAsOther'] = '与其他泳道使用相同看板
$lang->kanbanlane->modeList['independent'] = '采用独立的看板列';
$lang->kanbanregion = new stdclass();
$lang->kanbanregion->name = '看板区域';
$lang->kanbanregion->name = '区域名称';
$lang->kanbanregion->default = '默认区域';
$lang->kanbancard = new stdclass();
+40
View File
@@ -437,6 +437,18 @@ class kanbanModel extends model
return $kanbanData;
}
/**
* Get region by id.
*
* @param int $regionID
* @access public
* @return array
*/
public function getRegionById($regionID)
{
return $this->dao->findById($regionID)->from(TABLE_KANBANREGION)->fetch();
}
/**
* Get ordered region pairs.
*
@@ -1286,6 +1298,34 @@ class kanbanModel extends model
}
}
/**
* Update a region.
*
* @param int $regionID
* @access public
* @return array
*/
public function updateRegion($regionID)
{
$region = fixer::input('post')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', helper::now())
->trim('name')
->get();
$oldRegion = $this->getRegionById($regionID);
$this->dao->update(TABLE_KANBANREGION)->data($region)
->autoCheck()
->batchcheck($this->config->kanban->editregion->requiredFields, 'notempty')
->where('id')->eq($regionID)
->exec();
if(dao::isError()) return;
$changes = common::createChanges($oldRegion, $region);
return $changes;
}
/**
* Update kanban lane.
*
+38
View File
@@ -0,0 +1,38 @@
<?php
/**
* The editregion file of task module of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Mengyi Liu <liumengyi@easycorp.ltd>
* @package kanban
* @version $Id: editregion.html.php 935 2021-10-26 16:24:24Z liumengyi@easycorp.ltd $
* @link https://www.zentao.net
*/
?>
<?php include '../../common/view/header.lite.html.php';?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
<h2>
<?php echo $lang->kanban->editRegion;?>
</h2>
</div>
<form class="load-indicator main-form form-ajax" method='post'>
<table align='center' class='table table-form'>
<tr>
<th><?php echo $lang->kanbanregion->name;?></th>
<td colspan='2'>
<?php echo html::input('name', $region->name, "class='form-control'");?>
</td>
</tr>
<tr>
<td colspan='4' class='text-center form-actions'>
<?php echo html::submitButton();?>
</td>
</tr>
</table>
</form>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>