From d4950444ad3568c277e5909a89c012be265b41ba Mon Sep 17 00:00:00 2001
From: leiyong <1549684884@qq.com>
Date: Thu, 20 Aug 2020 13:36:25 +0800
Subject: [PATCH 1/5] * Adjust sql.
---
db/update20.0.sql | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/db/update20.0.sql b/db/update20.0.sql
index bdf5405cfd..c86ef8bd2d 100644
--- a/db/update20.0.sql
+++ b/db/update20.0.sql
@@ -272,16 +272,16 @@ CREATE TABLE `zt_taskspec` (
CREATE TABLE `zt_weeklyreport`(
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
- `program` mediumint(8) unsigned NOT NULL,
- `weekStart` date NOT NULL,
- `pv` float(9,2) NOT NULL,
- `ev` float(9,2) NOT NULL,
- `ac` float(9,2) NOT NULL,
- `sv` float(9,2) NOT NULL,
- `cv` float(9,2) NOT NULL,
+ `program` mediumint(8) unsigned NOT NULL,
+ `weekStart` date NOT NULL,
+ `pv` float(9,2) NOT NULL,
+ `ev` float(9,2) NOT NULL,
+ `ac` float(9,2) NOT NULL,
+ `sv` float(9,2) NOT NULL,
+ `cv` float(9,2) NOT NULL,
`staff` smallint(5) unsigned NOT NULL,
- `progress` varchar(255) NOT NULL,
- `workload` varchar(255) NOT NULL,
+ `progress` varchar(255) NOT NULL,
+ `workload` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `week` (`program`,`weekStart`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
From 1ed91ca91869e67f4df60abfafc1150537fb9f02 Mon Sep 17 00:00:00 2001
From: holan20180123 <56391770@qq.com>
Date: Thu, 20 Aug 2020 14:56:37 +0800
Subject: [PATCH 2/5] * Add risk module.
---
module/risk/config.php | 2 +-
module/risk/control.php | 257 ++++++++++++++----
module/risk/ext/lang/zh-cn/cmmi.php | 7 -
.../risk/ext/view/assign.cmmi.html.hook.php | 14 -
.../risk/ext/view/cancel.cmmi.html.hook.php | 14 -
module/risk/ext/view/check.cmmi.html.hook.php | 28 --
.../risk/ext/view/create.cmmi.html.hook.php | 28 --
module/risk/ext/view/edit.cmmi.html.hook.php | 28 --
module/risk/js/track.js | 5 -
module/risk/lang/zh-cn.php | 11 +-
module/risk/model.php | 125 ++++++++-
module/risk/view/assignto.html.php | 3 +-
module/risk/view/batchcreate.html.php | 36 +++
module/risk/view/cancel.html.php | 6 +-
module/risk/view/close.html.php | 3 +-
module/risk/view/create.html.php | 1 +
module/risk/view/edit.html.php | 148 +++++-----
module/risk/view/tags | 7 -
module/risk/view/track.html.php | 34 +--
19 files changed, 460 insertions(+), 297 deletions(-)
delete mode 100644 module/risk/ext/lang/zh-cn/cmmi.php
delete mode 100644 module/risk/ext/view/assign.cmmi.html.hook.php
delete mode 100644 module/risk/ext/view/cancel.cmmi.html.hook.php
delete mode 100644 module/risk/ext/view/check.cmmi.html.hook.php
delete mode 100644 module/risk/ext/view/create.cmmi.html.hook.php
delete mode 100644 module/risk/ext/view/edit.cmmi.html.hook.php
create mode 100644 module/risk/view/batchcreate.html.php
delete mode 100644 module/risk/view/tags
diff --git a/module/risk/config.php b/module/risk/config.php
index b688aa7ecb..5b8c889353 100644
--- a/module/risk/config.php
+++ b/module/risk/config.php
@@ -60,4 +60,4 @@ $config->risk->search['params']['activateBy'] = array('operator' => '=',
$config->risk->search['params']['assignedTo'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->risk->search['params']['cancelBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
$config->risk->search['params']['hangupBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
-$config->risk->search['params']['trackedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
+$config->risk->search['params']['trackedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users');
diff --git a/module/risk/control.php b/module/risk/control.php
index 265fddeff2..916a0d0a0f 100644
--- a/module/risk/control.php
+++ b/module/risk/control.php
@@ -1,12 +1,23 @@
createLink('risk', 'browse', "browseType=bySearch&queryID=myQueryID");
- $this->config->risk->search['onMenuBar'] = 'yes';
+ $actionURL = $this->createLink('risk', 'browse', "browseType=bysearch&queryID=myQueryID");
$this->risk->buildSearchForm($queryID, $actionURL);
/* Load pager. */
@@ -14,18 +25,24 @@ class risk extends control
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
$pager = pager::init($recTotal, $recPerPage, $pageID);
- $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->browse;
- $this->view->position[] = $this->lang->risk->browse;
- $this->view->risks = $this->risk->getList($browseType, $param, $orderBy, $pager);
- $this->view->browseType = $browseType;
- $this->view->param = $param;
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->view->users = $this->loadModel('user')->getPairs('noletter');
+ $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->browse;
+ $this->view->position[] = $this->lang->risk->browse;
+ $this->view->risks = $this->risk->getList($browseType, $param, $orderBy, $pager);
+ $this->view->browseType = $browseType;
+ $this->view->param = $param;
+ $this->view->orderBy = $orderBy;
+ $this->view->pager = $pager;
+ $this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
}
+ /**
+ * Create risk
+ *
+ * @access public
+ * @return void
+ */
public function create()
{
if($_POST)
@@ -46,13 +63,20 @@ class risk extends control
$this->send($response);
}
- $this->view->users = $this->loadModel('user')->getPairs();
- $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->create;
- $this->view->position[] = $this->lang->risk->create;
+ $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->create;
+ $this->view->position[] = $this->lang->risk->create;
+ $this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->display();
}
+ /**
+ * Edit risk
+ *
+ * @param int $riskID
+ * @access public
+ * @return void
+ */
public function edit($riskID)
{
if($_POST)
@@ -69,25 +93,38 @@ class risk extends control
}
$this->loadModel('action');
- $actionID = $this->action->create('risk', $riskID, 'Edited');
- $this->action->logHistory($actionID, $changes);
+ if(!empty($changes))
+ {
+ $actionID = $this->action->create('risk', $riskID, 'Edited');
+ $this->action->logHistory($actionID, $changes);
+ }
- $response['locate'] = inlink('browse');
+ $response['locate'] = inlink('browse');
$this->send($response);
}
- $this->view->risk = $this->risk->getById($riskID);
- $this->view->users = $this->loadModel('user')->getPairs();
- $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->edit;
- $this->view->position[] = $this->lang->risk->edit;
+ $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->edit;
+ $this->view->position[] = $this->lang->risk->edit;
+ $this->view->risk = $this->risk->getById($riskID);
+ $this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->display();
}
+ /**
+ * View a risk
+ *
+ * @param int $riskID
+ * @access public
+ * @return void
+ */
public function view($riskID)
{
$this->loadModel('action');
+ $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->view;
+ $this->view->position[] = $this->lang->risk->view;
+
$this->view->risk = $this->risk->getById($riskID);
$this->view->actions = $this->action->getList('risk', $riskID);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
@@ -95,6 +132,46 @@ class risk extends control
$this->display();
}
+ /**
+ * Batch create
+ *
+ * @access public
+ * @return void
+ */
+ public function batchCreate()
+ {
+ if($_POST)
+ {
+ $this->risk->batchCreate();
+
+ $response['result'] = 'success';
+ $response['message'] = $this->lang->saveSuccess;
+ if(dao::isError())
+ {
+ $response['result'] = 'fail';
+ $response['message'] = dao::getError();
+ $this->send($response);
+ }
+
+ $response['locate'] = inlink('browse');
+ $this->send($response);
+ }
+
+ $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->batchCreate;
+ $this->view->position[] = $this->lang->risk->batchCreate;
+
+ $this->view->users = $this->loadModel('user')->getPairs('noclosed');
+ $this->display();
+ }
+
+ /**
+ * Delete a risk.
+ *
+ * @param int $riskID
+ * @param string $confirm
+ * @access public
+ * @return void
+ */
public function delete($riskID, $confirm = 'no')
{
$risk = $this->risk->getById($riskID);
@@ -112,11 +189,19 @@ class risk extends control
}
}
+ /**
+ * Track a risk.
+ *
+ * @param int $riskID
+ * @access public
+ * @return void
+ */
public function track($riskID)
{
if($_POST)
{
- $changes = $this->risk->track($riskID);
+ $changes = array();
+ if($this->post->isChange == 1) $changes = $this->risk->track($riskID);
$response['result'] = 'success';
$response['message'] = $this->lang->saveSuccess;
@@ -128,20 +213,31 @@ class risk extends control
}
$this->loadModel('action');
- $actionID = $this->action->create('risk', $riskID, 'Tracked' . $this->post->commnet);
- $this->action->logHistory($actionID, $changes);
+ if(!empty($changes) or $_POST['comment'])
+ {
+ $actionID = $this->action->create('risk', $riskID, 'Tracked', $_POST['comment']);
+ $this->action->logHistory($actionID, $changes);
+ }
$response['locate'] = inlink('browse');
$this->send($response);
}
- $this->view->risk = $this->risk->getById($riskID);
- $this->view->users = $this->loadModel('user')->getPairs();
+
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->track;
$this->view->position[] = $this->lang->risk->track;
+ $this->view->risk = $this->risk->getById($riskID);
+ $this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->display();
}
+ /**
+ * Update assign of risk.
+ *
+ * @param int $riskID
+ * @access public
+ * @return void
+ */
public function assignTo($riskID)
{
if($_POST)
@@ -150,22 +246,32 @@ class risk extends control
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
- $actionID = $this->action->create('risk', $riskID, 'Assigned', $this->post->comment, $this->post->assignedTo);
- $this->action->logHistory($actionID, $changes);
-
+ if(!empty($changes))
+ {
+ $actionID = $this->action->create('risk', $riskID, 'Assigned', $this->post->comment, $this->post->assignedTo);
+ $this->action->logHistory($actionID, $changes);
+ }
+
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
- $risk = $this->risk->getById($riskID);
+ $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->assignedTo;
+ $this->view->position[] = $this->lang->risk->assignedTo;
+
+ $this->view->risk = $this->risk->getById($riskID);
$this->view->users = $this->loadModel('user')->getPairs();
- $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->assignedTo;
- $this->view->risk = $risk;
-
$this->display();
}
+ /**
+ * Cancel a risk.
+ *
+ * @param int $riskID
+ * @access public
+ * @return void
+ */
public function cancel($riskID)
{
if($_POST)
@@ -174,21 +280,31 @@ class risk extends control
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action');
- $actionID = $this->action->create('risk', $riskID, 'Canceled', $this->post->comment);
- $this->action->logHistory($actionID, $changes);
+ if(!empty($changes))
+ {
+ $actionID = $this->action->create('risk', $riskID, 'Canceled', $this->post->comment);
+ $this->action->logHistory($actionID, $changes);
+ }
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
- $risk = $this->risk->getById($riskID);
- $this->view->users = $this->loadModel('user')->getPairs();
- $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->cancel;
- $this->view->risk = $risk;
+ $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->cancel;
+ $this->view->position[] = $this->lang->risk->cancel;
+ $this->view->users = $this->loadModel('user')->getPairs('noclosed');
+ $this->view->risk = $this->risk->getById($riskID);
$this->display();
}
+ /**
+ * Close a risk.
+ *
+ * @param int $riskID
+ * @access public
+ * @return void
+ */
public function close($riskID)
{
if($_POST)
@@ -196,22 +312,32 @@ class risk extends control
$changes = $this->risk->close($riskID);
if(dao::isError()) die(js::error(dao::getError()));
- $this->loadModel('action');
- $actionID = $this->action->create('risk', $riskID, 'Closed', $this->post->comment);
- $this->action->logHistory($actionID, $changes);
+ if(!empty($changes))
+ {
+ $this->loadModel('action');
+ $actionID = $this->action->create('risk', $riskID, 'Closed', $this->post->comment);
+ $this->action->logHistory($actionID, $changes);
+ }
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
- $risk = $this->risk->getById($riskID);
+
+ $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->close;
+ $this->view->position[] = $this->lang->risk->close;
$this->view->users = $this->loadModel('user')->getPairs();
- $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->close;
- $this->view->risk = $risk;
-
+ $this->view->risk = $this->risk->getById($riskID);
$this->display();
}
+ /**
+ * Hangup a risk.
+ *
+ * @param int $riskID
+ * @access public
+ * @return void
+ */
public function hangup($riskID)
{
if($_POST)
@@ -219,22 +345,32 @@ class risk extends control
$changes = $this->risk->hangup($riskID);
if(dao::isError()) die(js::error(dao::getError()));
- $this->loadModel('action');
- $actionID = $this->action->create('risk', $riskID, 'Hangup', $this->post->comment);
- $this->action->logHistory($actionID, $changes);
+ if(!empty($changes))
+ {
+ $this->loadModel('action');
+ $actionID = $this->action->create('risk', $riskID, 'Hangup', $this->post->comment);
+ $this->action->logHistory($actionID, $changes);
+ }
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
- $risk = $this->risk->getById($riskID);
- $this->view->users = $this->loadModel('user')->getPairs();
- $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->hangup;
- $this->view->risk = $risk;
+ $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->hangup;
+ $this->view->position[] = $this->lang->risk->hangup;
+ $this->view->users = $this->loadModel('user')->getPairs('noclosed');
+ $this->view->risk = $this->risk->getById($riskID);
$this->display();
}
+ /**
+ * Activate a risk.
+ *
+ * @param int $riskID
+ * @access public
+ * @return void
+ */
public function activate($riskID)
{
if($_POST)
@@ -242,19 +378,22 @@ class risk extends control
$changes = $this->risk->activate($riskID);
if(dao::isError()) die(js::error(dao::getError()));
- $this->loadModel('action');
- $actionID = $this->action->create('risk', $riskID, 'Activated', $this->post->comment);
- $this->action->logHistory($actionID, $changes);
+ if(!empty($changes))
+ {
+ $this->loadModel('action');
+ $actionID = $this->action->create('risk', $riskID, 'Activated', $this->post->comment);
+ $this->action->logHistory($actionID, $changes);
+ }
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
- $risk = $this->risk->getById($riskID);
- $this->view->users = $this->loadModel('user')->getPairs();
- $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->activate;
- $this->view->risk = $risk;
+ $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->activate;
+ $this->view->position[] = $this->lang->risk->activate;
+ $this->view->users = $this->loadModel('user')->getPairs('noclosed');
+ $this->view->risk = $this->risk->getById($riskID);
$this->display();
}
}
diff --git a/module/risk/ext/lang/zh-cn/cmmi.php b/module/risk/ext/lang/zh-cn/cmmi.php
deleted file mode 100644
index 6ce5c5665a..0000000000
--- a/module/risk/ext/lang/zh-cn/cmmi.php
+++ /dev/null
@@ -1,7 +0,0 @@
-risk->comment = '备注';
-$lang->risk->isChanged = '风险是否有变化';
-
-$lang->risk->changedList[''] = '';
-$lang->risk->changedList['1'] = '是';
-$lang->risk->changedList['2'] = '否';
diff --git a/module/risk/ext/view/assign.cmmi.html.hook.php b/module/risk/ext/view/assign.cmmi.html.hook.php
deleted file mode 100644
index 847a504a11..0000000000
--- a/module/risk/ext/view/assign.cmmi.html.hook.php
+++ /dev/null
@@ -1,14 +0,0 @@
-app->getModuleRoot() . 'risk/ext/lang/zh-cn/cmmi.php';
-$html = "
";
-$html .= "| {$lang->risk->comment} | ";
-$html .= "";
-$html .= html::textarea('comment', '', 'class="form-control" rows="5"');
-$html .= " |
";
-?>
-
-
-
-
diff --git a/module/risk/ext/view/cancel.cmmi.html.hook.php b/module/risk/ext/view/cancel.cmmi.html.hook.php
deleted file mode 100644
index 622929b98a..0000000000
--- a/module/risk/ext/view/cancel.cmmi.html.hook.php
+++ /dev/null
@@ -1,14 +0,0 @@
-app->getModuleRoot() . 'risk/ext/lang/zh-cn/cmmi.php';
-$html = "";
-$html .= "| {$lang->risk->comment} | ";
-$html .= "";
-$html .= html::textarea('comment', '', 'class="form-control" rows="5"');
-$html .= " |
";
-?>
-
-
-
-
diff --git a/module/risk/ext/view/check.cmmi.html.hook.php b/module/risk/ext/view/check.cmmi.html.hook.php
deleted file mode 100644
index 2c20a6c490..0000000000
--- a/module/risk/ext/view/check.cmmi.html.hook.php
+++ /dev/null
@@ -1,28 +0,0 @@
-
diff --git a/module/risk/ext/view/create.cmmi.html.hook.php b/module/risk/ext/view/create.cmmi.html.hook.php
deleted file mode 100644
index 4d26bf934c..0000000000
--- a/module/risk/ext/view/create.cmmi.html.hook.php
+++ /dev/null
@@ -1,28 +0,0 @@
-
diff --git a/module/risk/ext/view/edit.cmmi.html.hook.php b/module/risk/ext/view/edit.cmmi.html.hook.php
deleted file mode 100644
index 40161241c6..0000000000
--- a/module/risk/ext/view/edit.cmmi.html.hook.php
+++ /dev/null
@@ -1,28 +0,0 @@
-
diff --git a/module/risk/js/track.js b/module/risk/js/track.js
index e26b98e9d3..ee7a922ec5 100644
--- a/module/risk/js/track.js
+++ b/module/risk/js/track.js
@@ -1,8 +1,3 @@
-$(function()
-{
- $('.track').addClass('hidden');
-})
-
function refreshPage(obj)
{
var value = obj.value;
diff --git a/module/risk/lang/zh-cn.php b/module/risk/lang/zh-cn.php
index 5f4019239e..3017926153 100644
--- a/module/risk/lang/zh-cn.php
+++ b/module/risk/lang/zh-cn.php
@@ -4,6 +4,7 @@ $lang->risk->batchCreate = '批量添加';
$lang->risk->create = '添加风险';
$lang->risk->edit = '编辑风险';
$lang->risk->browse = '浏览列表';
+$lang->risk->view = '风险详情';
$lang->risk->activate = '激活';
$lang->risk->hangup = '挂起';
$lang->risk->close = '关闭';
@@ -13,10 +14,6 @@ $lang->risk->assignTo = '指派';
$lang->risk->deleted = '删除';
$lang->risk->byQuery = '搜索';
-$lang->risk->legendBasicInfo = '基本信息';
-$lang->risk->legendLifeTime = '风险的一生';
-$lang->risk->confirmDelete = '您确认删除该风险吗?';
-
/* Fields */
$lang->risk->common = '风险';
$lang->risk->source = '来源';
@@ -49,12 +46,16 @@ $lang->risk->hangupBy = '由谁挂起';
$lang->risk->hangupDate = '挂起日期';
$lang->risk->activateBy = '由谁激活';
$lang->risk->activateDate = '激活日期';
-$lang->risk->isChange = '是否有变化';
+$lang->risk->isChange = '风险是否变化';
$lang->risk->trackedBy = '由谁跟踪';
$lang->risk->trackedDate = '跟踪日期';
$lang->risk->editedBy = '由谁编辑';
$lang->risk->editedDate = '编辑日期';
+$lang->risk->legendBasicInfo = '基本信息';
+$lang->risk->legendLifeTime = '风险的一生';
+$lang->risk->confirmDelete = '您确认删除该风险吗?';
+
$lang->risk->action = new stdclass();
$lang->risk->action->hangup = '$date, 由 $actor 挂起。' . "\n";
$lang->risk->action->tracked = '$date, 由 $actor 跟踪。' . "\n";
diff --git a/module/risk/model.php b/module/risk/model.php
index 68022208c6..467b69b9f2 100644
--- a/module/risk/model.php
+++ b/module/risk/model.php
@@ -1,6 +1,12 @@
get();
@@ -29,8 +41,10 @@ class riskModel extends model
$risk = new stdclass();
$risk->name = $name;
- $risk->percent = $data->percent[$i];
- $risk->type = $data->type[$i];
+ $risk->source = $data->source[$i];
+ $risk->category = $data->category[$i];
+ $risk->strategy = $data->strategy[$i];
+ $risk->program = $this->session->program;
$risk->createdBy = $this->app->user->account;
$risk->createdDate = helper::today();
@@ -43,6 +57,13 @@ class riskModel extends model
return true;
}
+ /**
+ * Update a risk.
+ *
+ * @param int $riskID
+ * @access public
+ * @return array|bool
+ */
public function update($riskID)
{
$oldRisk = $this->dao->select('*')->from(TABLE_RISK)->where('id')->eq((int)$riskID)->fetch();
@@ -60,6 +81,13 @@ class riskModel extends model
return false;
}
+ /**
+ * Track a risk.
+ *
+ * @param int $riskID
+ * @access public
+ * @return array|bool
+ */
public function track($riskID)
{
$oldRisk = $this->dao->select('*')->from(TABLE_RISK)->where('id')->eq((int)$riskID)->fetch();
@@ -68,8 +96,7 @@ class riskModel extends model
->add('editedBy', $this->app->user->account)
->add('editedDate', helper::today())
->stripTags($this->config->risk->editor->track['id'], $this->config->allowedTags)
- ->remove('ischange,comment,uid')
- ->removeIF($this->post->isChange == 0, 'name,category,strategy,impact,probability,riskindex,pri,prevention,resolution' )
+ ->remove('isChange,comment,uid,files,label')
->get();
$this->dao->update(TABLE_RISK)->data($risk)->autoCheck()->where('id')->eq((int)$riskID)->exec();
@@ -78,6 +105,16 @@ class riskModel extends model
return false;
}
+ /**
+ * Get risks List.
+ *
+ * @param string $browseType
+ * @param string $param
+ * @param string $orderBy
+ * @param int $pager
+ * @access public
+ * @return object
+ */
public function getList($browseType = '', $param = '', $orderBy = 'id_desc', $pager = null)
{
if($browseType == 'bySearch') return $this->getBySearch($param, $orderBy, $pager);
@@ -92,9 +129,18 @@ class riskModel extends model
->fetchAll('id');
}
+ /**
+ * Get risks by search
+ *
+ * @param string $queryID
+ * @param string $orderBy
+ * @param int $pager
+ * @access public
+ * @return object
+ */
public function getBySearch($queryID = '', $orderBy = 'id_desc', $pager = null)
{
- if($queryID)
+ if($queryID && $queryID != 'myQueryID')
{
$query = $this->loadModel('search')->getQuery($queryID);
if($query)
@@ -112,7 +158,7 @@ class riskModel extends model
if($this->session->riskQuery == false) $this->session->set('riskQuery', ' 1 = 1');
}
- $riskQuery = $this->session->riskQuery;
+ $riskQuery = $this->session->riskQuery;
return $this->dao->select('*')->from(TABLE_RISK)
->where($riskQuery)
@@ -123,6 +169,12 @@ class riskModel extends model
->fetchAll('id');
}
+ /**
+ * Get risks of pairs
+ *
+ * @access public
+ * @return object
+ */
public function getPairs()
{
return $this->dao->select('id, name')->from(TABLE_RISK)
@@ -131,11 +183,26 @@ class riskModel extends model
->fetchPairs();
}
+ /**
+ * Get risk by ID
+ *
+ * @param int $riskID
+ * @access public
+ * @return object
+ */
public function getByID($riskID)
{
return $this->dao->select('*')->from(TABLE_RISK)->where('id')->eq((int)$riskID)->fetch();
}
+ /**
+ * Print assignedTo html
+ *
+ * @param int $risk
+ * @param int $users
+ * @access public
+ * @return string
+ */
public function printAssignedHtml($risk, $users)
{
$btnTextClass = '';
@@ -156,6 +223,13 @@ class riskModel extends model
echo !common::hasPriv('risk', 'assignTo', $risk) ? "{$assignedToText}" : $assignToHtml;
}
+ /**
+ * Assign a risk.
+ *
+ * @param int $riskID
+ * @access public
+ * @return array|bool
+ */
public function assign($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -165,7 +239,7 @@ class riskModel extends model
->add('editedDate', helper::today())
->setDefault('assignedDate', helper::today())
->stripTags($this->config->risk->editor->assignto['id'], $this->config->allowedTags)
- ->remove('uid,comment')
+ ->remove('uid,comment,files,label')
->get();
$this->dao->update(TABLE_RISK)->data($risk)->autoCheck()->where('id')->eq((int)$riskID)->exec();
@@ -174,6 +248,13 @@ class riskModel extends model
return false;
}
+ /**
+ * Cancel a risk.
+ *
+ * @param int $riskID
+ * @access public
+ * @return array|bool
+ */
public function cancel($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -192,6 +273,13 @@ class riskModel extends model
return false;
}
+ /**
+ * Close a risk.
+ *
+ * @param int $riskID
+ * @access public
+ * @return array|bool
+ */
public function close($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -210,6 +298,13 @@ class riskModel extends model
return false;
}
+ /**
+ * Hangup a risk.
+ *
+ * @param int $riskID
+ * @access public
+ * @return array|bool
+ */
public function hangup($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -226,6 +321,13 @@ class riskModel extends model
return false;
}
+ /**
+ * Activate a risk.
+ *
+ * @param int $riskID
+ * @access public
+ * @return array|bool
+ */
public function activate($riskID)
{
$oldRisk = $this->getByID($riskID);
@@ -242,6 +344,15 @@ class riskModel extends model
return false;
}
+ /**
+ * Adjust the action is clickable.
+ *
+ * @param int $risk
+ * @param int $action
+ * @static
+ * @access public
+ * @return bool
+ */
public static function isClickable($risk, $action)
{
$action = strtolower($action);
diff --git a/module/risk/view/assignto.html.php b/module/risk/view/assignto.html.php
index a9ba6f0218..039d43d092 100644
--- a/module/risk/view/assignto.html.php
+++ b/module/risk/view/assignto.html.php
@@ -17,7 +17,8 @@
| comment;?> |
- |
+ |
+
|
diff --git a/module/risk/view/batchcreate.html.php b/module/risk/view/batchcreate.html.php
new file mode 100644
index 0000000000..454bc77718
--- /dev/null
+++ b/module/risk/view/batchcreate.html.php
@@ -0,0 +1,36 @@
+
+
+
+
risk->batchCreate;?>
+
+
+
+
diff --git a/module/risk/view/cancel.html.php b/module/risk/view/cancel.html.php
index b00dd8c37b..bb23abfb61 100644
--- a/module/risk/view/cancel.html.php
+++ b/module/risk/view/cancel.html.php
@@ -26,9 +26,11 @@
| comment;?> |
- |
+ |
+
- |
+ |
+
diff --git a/module/risk/view/close.html.php b/module/risk/view/close.html.php
index 0a09ecf68f..284c9ce0f1 100644
--- a/module/risk/view/close.html.php
+++ b/module/risk/view/close.html.php
@@ -21,7 +21,8 @@
|
| risk->resolution;?> |
- |
+ |
+
|
diff --git a/module/risk/view/create.html.php b/module/risk/view/create.html.php
index 112f830e70..41b58722e9 100644
--- a/module/risk/view/create.html.php
+++ b/module/risk/view/create.html.php
@@ -12,6 +12,7 @@
risk->source;?> |
risk->sourceList, '', "class='form-control chosen'");?> |
|
+ |
| risk->name;?> |
diff --git a/module/risk/view/edit.html.php b/module/risk/view/edit.html.php
index 1f7b8953c9..2bbc8a4a53 100644
--- a/module/risk/view/edit.html.php
+++ b/module/risk/view/edit.html.php
@@ -8,81 +8,81 @@
diff --git a/module/risk/view/tags b/module/risk/view/tags
deleted file mode 100644
index b627f1f9e9..0000000000
--- a/module/risk/view/tags
+++ /dev/null
@@ -1,7 +0,0 @@
-!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
-!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
-!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
-!_TAG_PROGRAM_NAME Exuberant Ctags //
-!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
-!_TAG_PROGRAM_VERSION 5.9~svn20110310 //
-params browse.html.php /^ $params = "riskID=$risk->id";$/;" v
diff --git a/module/risk/view/track.html.php b/module/risk/view/track.html.php
index 6736c3cc8c..6b0e0caf66 100644
--- a/module/risk/view/track.html.php
+++ b/module/risk/view/track.html.php
@@ -12,50 +12,52 @@
risk->isChange;?> |
risk->isChangeList, 0, "onclick=refreshPage(this)");?> |
|
+ |
-
+
| risk->name;?> |
name, "class='form-control'");?> |
-
+
| risk->category;?> |
risk->categoryList, $risk->category, "class='form-control chosen'");?> |
-
+
| risk->strategy;?> |
risk->strategyList, $risk->strategy, "class='form-control chosen'");?> |
-
+
| risk->impact;?> |
risk->impactList, $risk->impact, "class='form-control chosen'");?> |
-
+
| risk->probability;?> |
risk->probabilityList, $risk->impact, "class='form-control chosen'");?> |
-
+
| risk->riskindex;?> |
riskindex, "class='form-control'");?> |
-
+
| risk->pri;?> |
risk->priList, $risk->pri, "class='form-control chosen'");?> |
-
+
+ | risk->trackedBy;?> |
+ app->user->account, "class='form-control chosen'");?> |
+
+
+ | risk->trackedDate;?> |
+ trackedDate == '0000-00-00' ? helper::today() : $risk->trackedDate , "class='form-control form-date'");?> |
+
+
| risk->prevention;?> |
prevention, "class='form-control'");?> |
-
+
| risk->resolution;?> |
resolution, "class='form-control'");?> |
-
- | risk->trackedBy;?> |
- app->user->account, "class='form-control chosen'");?> |
-
- | risk->trackedDate;?> |
- trackedDate == '0000-00-00' ? $risk->trackedDate : helper::today(), "class='form-control form-date'");?> |
-
| comment;?> |
|
From 9c1ff185a2db20a7f79bca12d66677a92f16be0c Mon Sep 17 00:00:00 2001
From: Yagami <976204163@qq.com>
Date: Thu, 20 Aug 2020 15:06:08 +0800
Subject: [PATCH 3/5] * Add issue block.
---
module/block/control.php | 2 +-
module/block/view/cmmiissueblock.html.php | 10 +++++----
module/issue/lang/zh-cn.php | 10 ++++-----
module/issue/view/batchcreate.html.php | 2 +-
module/issue/view/create.html.php | 2 +-
module/issue/view/edit.html.php | 2 +-
module/weekly/model.php | 25 ++++++++++++-----------
7 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/module/block/control.php b/module/block/control.php
index 1ce25ab946..4a034203b5 100644
--- a/module/block/control.php
+++ b/module/block/control.php
@@ -1001,7 +1001,6 @@ class block extends control
->andWhere('parent')->lt(1)
->fetch();
-
$this->view->pv = $this->weekly->getPV($this->session->program, $today);
$this->view->ev = $this->weekly->getEV($this->session->program, $today);
$this->view->ac = $this->weekly->getAC($this->session->program, $today);
@@ -1034,6 +1033,7 @@ class block extends control
$uri = $this->app->getURI(true);
$this->session->set('riskList', $uri);
if(preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) die();
+ $this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->issues = $this->loadModel('issue')->getBlockIssues($this->params->type, $this->viewType == 'json' ? 0 : (int)$this->params->num, null, $this->params->orderBy);
}
diff --git a/module/block/view/cmmiissueblock.html.php b/module/block/view/cmmiissueblock.html.php
index 2c3494926e..2812fdb5d2 100644
--- a/module/block/view/cmmiissueblock.html.php
+++ b/module/block/view/cmmiissueblock.html.php
@@ -15,11 +15,12 @@
| idAB;?> |
issue->type;?> |
- issue->name;?> |
+ issue->title;?> |
- issue->severity;?> |
- issue->pri;?> |
+ issue->severity;?> |
+ issue->pri;?> |
+ issue->owner;?> |
issue->assignedTo;?> |
issue->status;?> |
@@ -32,11 +33,12 @@
| id);?> |
issue->typeList, $issue->type);?> |
- name?> |
+ title);?> |
issue->severityList, $issue->severity, $issue->severity)?> |
issue->priList, $issue->pri, $issue->pri)?> |
+ owner, $issue->owner)?> |
assignedTo, $issue->assignedTo)?> |
issue->statusList, $issue->status);?>
diff --git a/module/issue/lang/zh-cn.php b/module/issue/lang/zh-cn.php
index eabb76d33f..662743a67d 100644
--- a/module/issue/lang/zh-cn.php
+++ b/module/issue/lang/zh-cn.php
@@ -51,11 +51,11 @@ $lang->issue->priList['2'] = 2;
$lang->issue->priList['3'] = 3;
$lang->issue->priList['4'] = 4;
-$lang->issue->serverityList[''] = '';
-$lang->issue->serverityList['1'] = '严重';
-$lang->issue->serverityList['2'] = '较严重';
-$lang->issue->serverityList['3'] = '较小';
-$lang->issue->serverityList['4'] = '建议';
+$lang->issue->severityList[''] = '';
+$lang->issue->severityList['1'] = '严重';
+$lang->issue->severityList['2'] = '较严重';
+$lang->issue->severityList['3'] = '较小';
+$lang->issue->severityList['4'] = '建议';
$lang->issue->typeList[''] = '';
$lang->issue->typeList['design'] = '设计问题';
diff --git a/module/issue/view/batchcreate.html.php b/module/issue/view/batchcreate.html.php
index 62331b46a4..f231614fe0 100644
--- a/module/issue/view/batchcreate.html.php
+++ b/module/issue/view/batchcreate.html.php
@@ -38,7 +38,7 @@
issue->typeList, '', 'class="form-control chosen chosen-controled" id="dataList'.$i.'type"')?>
|
- issue->serverityList, '', 'class="form-control chosen chosen-controled" id="dataList'.$i.'severity"')?>
+ issue->severityList, '', 'class="form-control chosen chosen-controled" id="dataList'.$i.'severity"')?>
|
diff --git a/module/issue/view/create.html.php b/module/issue/view/create.html.php
index df2384481f..d1b607a15b 100644
--- a/module/issue/view/create.html.php
+++ b/module/issue/view/create.html.php
@@ -34,7 +34,7 @@
|
| issue->severity;?> |
- issue->serverityList, '', 'class="form-control chosen"');?> |
+ issue->severityList, '', 'class="form-control chosen"');?> |
|
|
diff --git a/module/issue/view/edit.html.php b/module/issue/view/edit.html.php
index a59f0e42b5..d2addf77ca 100644
--- a/module/issue/view/edit.html.php
+++ b/module/issue/view/edit.html.php
@@ -34,7 +34,7 @@
| issue->severity;?> |
- issue->serverityList, $issue->severity, 'class="form-control chosen"');?> |
+ issue->severityList, $issue->severity, 'class="form-control chosen"');?> |
|
|
diff --git a/module/weekly/model.php b/module/weekly/model.php
index 4f8a7df181..5366dcfd2e 100644
--- a/module/weekly/model.php
+++ b/module/weekly/model.php
@@ -112,12 +112,13 @@ class weeklyModel extends model
$sunday = $this->getThisSunday($date);
$projects = $this->loadModel('project')->getList($status = 'all', $limit = 0, $productID = 0, $branch = 0, $type = 'project', $program);
$projectIdList = array_keys($projects);
- return $this->dao->select('count(distinct account) as count')
- ->from(TABLE_EFFORT)
- ->where('objectType')->eq('task')
- ->andWhere('project')->in($projectIdList)
- ->andWhere('date')->ge($monday)
- ->andWhere('date')->le($sunday)
+
+ return $this->dao->select('count(distinct t1.account) as count')
+ ->from(TABLE_TASKESTIMATE)->alias('t1')
+ ->leftJoin(TABLE_TASK)->alias('t2')->on('t1.task=t2.id')
+ ->where('t2.project')->in($projectIdList)
+ ->andWhere('t1.date')->ge($monday)
+ ->andWhere('t1.date')->lt($sunday)
->fetch('count');
}
@@ -312,12 +313,12 @@ class weeklyModel extends model
$projects = $this->loadModel('project')->getList($status = 'all', $limit = 0, $productID = 0, $branch = 0, $type = 'project', $program);
$projectIdList = array_keys($projects);
- $AC = $this->dao->select('sum(consumed) as consumed')
- ->from(TABLE_EFFORT)
- ->where('objectType')->eq('task')
- ->andWhere('project')->in($projectIdList)
- ->andWhere('date')->ge($monday)
- ->andWhere('date')->lt($nextMonday)
+ $AC = $this->dao->select('sum(t1.consumed) as consumed')
+ ->from(TABLE_TASKESTIMATE)->alias('t1')
+ ->leftJoin(TABLE_TASK)->alias('t2')->on('t1.task=t2.id')
+ ->where('t2.project')->in($projectIdList)
+ ->andWhere('t1.date')->ge($monday)
+ ->andWhere('t1.date')->lt($nextMonday)
->fetch('consumed');
return round($AC, 2);
From c82fc3ff60e4e605b8a3c7f36d77461aad3b0319 Mon Sep 17 00:00:00 2001
From: leiyong <1549684884@qq.com>
Date: Thu, 20 Aug 2020 15:49:26 +0800
Subject: [PATCH 4/5] * Add scrum block module.
---
db/update20.0.sql | 8 +++----
module/block/control.php | 7 +++---
module/block/lang/zh-cn.php | 18 +++++++++++++++-
module/block/model.php | 21 ++++++++++++++++++
module/block/view/scrumtestblock.html.php | 26 +++++++++++------------
module/task/control.php | 1 +
6 files changed, 58 insertions(+), 23 deletions(-)
diff --git a/db/update20.0.sql b/db/update20.0.sql
index c86ef8bd2d..5af7eb7c59 100644
--- a/db/update20.0.sql
+++ b/db/update20.0.sql
@@ -239,10 +239,10 @@ CREATE TABLE IF NOT EXISTS `zt_holiday` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL DEFAULT '',
`type` enum('holiday', 'working') NOT NULL DEFAULT 'holiday',
- `desc` text NOT NULL,
- `year` char(4) NOT NULL,
- `begin` date NOT NULL,
- `end` date NOT NULL,
+ `desc` text NOT NULL,
+ `year` char(4) NOT NULL,
+ `begin` date NOT NULL,
+ `end` date NOT NULL,
PRIMARY KEY (`id`),
KEY `year` (`year`),
KEY `name` (`name`)
diff --git a/module/block/control.php b/module/block/control.php
index 4a034203b5..de01ca3231 100644
--- a/module/block/control.php
+++ b/module/block/control.php
@@ -1440,18 +1440,17 @@ class block extends control
*/
public function printScrumtestBlock()
{
- $this->view->program = $this->loadModel('project')->getByID($this->session->program);
-
$this->session->set('testtaskList', $this->app->getURI(true));
if(preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) die();
$this->app->loadLang('testtask');
- $this->view->testtasks = $this->dao->select('t1.*,t2.name as productName,t3.name as buildName,t4.name as projectName')->from(TABLE_TESTTASK)->alias('t1')
+ $this->view->testtasks = $this->dao->select('t1.*,t2.name as productName,t3.name as buildName,t4.name as projectName')
+ ->from(TABLE_TESTTASK)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build=t3.id')
->leftJoin(TABLE_PROJECT)->alias('t4')->on('t1.project=t4.id')
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t5')->on('t1.project=t5.project')
->where('t1.deleted')->eq('0')
- ->beginIF(!$this->app->user->admin)->andWhere('t1.product')->in($this->app->user->view->products)->fi()
+ ->andWhere('t1.product')->eq($this->session->program)->fi()
->andWhere('t1.product = t5.product')
->beginIF($this->params->type != 'all')->andWhere('t1.status')->eq($this->params->type)->fi()
->orderBy('t1.id desc')
diff --git a/module/block/lang/zh-cn.php b/module/block/lang/zh-cn.php
index 4fa18ec0bd..818e5dcaf9 100644
--- a/module/block/lang/zh-cn.php
+++ b/module/block/lang/zh-cn.php
@@ -117,6 +117,10 @@ $lang->block->default['scrum']['program']['4']['title'] = '待测版本';
$lang->block->default['scrum']['program']['4']['block'] = 'scrumtest';
$lang->block->default['scrum']['program']['4']['grid'] = 8;
+$lang->block->default['scrum']['program']['4']['params']['type'] = 'all';
+$lang->block->default['scrum']['program']['4']['params']['num'] = '15';
+$lang->block->default['scrum']['program']['4']['params']['orderBy'] = 'id_desc';
+
$lang->block->default['scrum']['program']['5']['title'] = '产品总览';
$lang->block->default['scrum']['program']['5']['block'] = 'scrumproduct';
$lang->block->default['scrum']['program']['5']['grid'] = 4;
@@ -126,7 +130,7 @@ $lang->block->default['scrum']['program']['6']['block'] = 'scrumproject';
$lang->block->default['scrum']['program']['6']['grid'] = 4;
$lang->block->default['scrum']['program']['7']['title'] = '最新动态';
-$lang->block->default['scrum']['program']['7']['block'] = 'scrumoverview';
+$lang->block->default['scrum']['program']['7']['block'] = 'scrumdynamic';
$lang->block->default['scrum']['program']['7']['grid'] = 4;
$lang->block->default['product']['1']['title'] = $lang->productCommon . '统计';
@@ -315,6 +319,18 @@ $lang->block->moduleList['product'] = $lang->productCommon;
$lang->block->moduleList['project'] = $lang->projectCommon;
$lang->block->moduleList['qa'] = '测试';
$lang->block->moduleList['todo'] = '待办';
+$lang->block->moduleList['program'] = '项目';
+
+
+$lang->block->modules['program'] = new stdclass();
+$lang->block->modules['program']->availableBlocks = new stdclass();
+$lang->block->modules['program']->availableBlocks->scrumoverall = '项目整体情况';
+$lang->block->modules['program']->availableBlocks->scrumprogress = '进行中的迭代';
+$lang->block->modules['program']->availableBlocks->scrumproject = '迭代总览';
+$lang->block->modules['program']->availableBlocks->scrumproduct = '产品总览';
+$lang->block->modules['program']->availableBlocks->scrumtest = '待测版本';
+$lang->block->modules['program']->availableBlocks->scrumroadmap = '产品路线图';
+$lang->block->modules['program']->availableBlocks->scrumdynamic = '最新动态';
$lang->block->modules['product'] = new stdclass();
$lang->block->modules['product']->availableBlocks = new stdclass();
diff --git a/module/block/model.php b/module/block/model.php
index 9c8a109623..703856cd5e 100644
--- a/module/block/model.php
+++ b/module/block/model.php
@@ -661,4 +661,25 @@ class blockModel extends model
return $key == $hash;
}
+
+ /**
+ * Get testtask params.
+ *▫
+ * @param string $module▫
+ * @access public
+ * @return void
+ */
+ public function getScrumtestParams($module = '')
+ {
+ $params = new stdclass();
+ $params->type['name'] = $this->lang->block->type;
+ $params->type['options'] = $this->lang->block->typeList->testtask;
+ $params->type['control'] = 'select';
+
+ $params->num['name'] = $this->lang->block->num;
+ $params->num['default'] = 20;
+ $params->num['control'] = 'input';
+
+ return json_encode($params);
+ }
}
diff --git a/module/block/view/scrumtestblock.html.php b/module/block/view/scrumtestblock.html.php
index b4327a7afb..5cb099cef5 100644
--- a/module/block/view/scrumtestblock.html.php
+++ b/module/block/view/scrumtestblock.html.php
@@ -17,16 +17,15 @@
-
- | idAB?> |
- testtask->product;?> |
-
testtask->name;?> |
- testtask->project . '/' . $lang->testtask->build;?> |
+ testtask->product;?> |
- testtask->begin;?> |
- testtask->end;?> |
+
+ testtask->project?> |
+
+ testtask->build;?> |
+ testtask->status;?> |
@@ -36,16 +35,15 @@
$viewLink = $this->createLink('testtask', 'view', "testtaskID={$testtask->id}");
?>
>
-
- | id);?> |
- productName?> |
-
name?> |
- buildName?>'>projectName . '/' . $testtask->buildName?> |
+ productName?> |
- begin?> |
- end?> |
+
+ projectName?> |
+
+ buildName?> |
+ testtask->statusList, $testtask->status)?> |
diff --git a/module/task/control.php b/module/task/control.php
index 44b700a291..c6264caa62 100644
--- a/module/task/control.php
+++ b/module/task/control.php
@@ -81,6 +81,7 @@ class task extends control
}
$project = $this->project->getById($projectID);
+
$taskLink = $this->createLink('project', 'browse', "projectID=$projectID&tab=task");
$storyLink = $this->session->storyList ? $this->session->storyList : $this->createLink('project', 'story', "projectID=$projectID");
From 09cfff0dbc8d34f3d0f0597f6e4a1d34bb61bc19 Mon Sep 17 00:00:00 2001
From: z
Date: Thu, 20 Aug 2020 15:52:07 +0800
Subject: [PATCH 5/5] * finish task #7644,7642.
---
db/update20.0.sql | 3 ++
module/program/control.php | 29 +++++++++----
module/program/css/browse.css | 2 +
module/program/js/create.js | 4 +-
module/program/lang/zh-cn.php | 2 +
module/program/model.php | 52 +++++++++++++++++++++++
module/program/view/browsebylist.html.php | 3 +-
module/program/view/create.html.php | 7 ++-
8 files changed, 90 insertions(+), 12 deletions(-)
diff --git a/db/update20.0.sql b/db/update20.0.sql
index 93bc2f330c..7b67afca2c 100644
--- a/db/update20.0.sql
+++ b/db/update20.0.sql
@@ -269,3 +269,6 @@ CREATE TABLE `zt_taskspec` (
`deadline` date NOT NULL,
UNIQUE KEY `task` (`task`,`version`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+ALTER TABLE `zt_project` ADD `path` varchar(255) NOT NULL AFTER `parent`;
+ALTER TABLE `zt_project` ADD `grade` tinyint unsigned NOT NULL AFTER `path`;
diff --git a/module/program/control.php b/module/program/control.php
index dd123847c9..f576d170c2 100644
--- a/module/program/control.php
+++ b/module/program/control.php
@@ -22,7 +22,6 @@ class program extends control
$this->session->set('program', $programID);
$this->lang->navGroup->program = 'program';
-
$this->view->title = $this->lang->program->common . $this->lang->colon . $this->lang->program->index;
$this->view->position[] = $this->lang->program->index;
$this->view->program = $this->project->getByID($programID);
@@ -87,20 +86,19 @@ class program extends control
/**
* Create a program.
*
- * @param varchar $template
- * @param int $copyProgramID
+ * @param string $template
+ * @param int $programID
+ * @param int $copyProgramID
* @access public
* @return void
*/
- public function create($template = 'cmmi', $copyProgramID = '')
+ public function create($template = 'cmmi', $programID = 0, $copyProgramID = '')
{
if($_POST)
{
$projectID = $this->program->create();
- if(dao::isError())
- {
- $this->send(array('result' => 'fail', 'message' => $this->processErrors(dao::getError())));
- }
+ if(dao::isError()) $this->send(array('result' => 'fail', 'message' => $this->processErrors(dao::getError())));
+
$this->loadModel('action')->create('project', $projectID, 'opened');
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse', array('status' => 'wait', 'orderBy' => 'order_desc'))));
}
@@ -111,6 +109,19 @@ class program extends control
$whitelist = '';
$acl = 'open';
$privway = 'extend';
+
+ if($programID)
+ {
+ $program = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($programID)->fetch();
+ if($this->program->checkHasContent($programID))
+ {
+ echo js::alert($this->lang->program->cannotCreateChild);
+ die(js::locate('back'));
+ }
+
+ if(empty($template)) $template = $program->template;
+ }
+
if($copyProgramID)
{
$copyProgram = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($copyProgramID)->fetch();
@@ -120,6 +131,7 @@ class program extends control
$acl = $copyProgram->acl;
$privway = $copyProgram->privway;
$whitelist = $copyProgram->whitelist;
+ if(empty($template)) $template = $copyProgram->template;
}
$this->view->title = $this->lang->program->create;
@@ -134,6 +146,7 @@ class program extends control
$this->view->acl = $acl;
$this->view->privway = $privway;
$this->view->whitelist = $whitelist;
+ $this->view->programID = $programID;
$this->view->copyProgramID = $copyProgramID;
$this->display();
}
diff --git a/module/program/css/browse.css b/module/program/css/browse.css
index 42bc88fd60..0c1d1bde46 100644
--- a/module/program/css/browse.css
+++ b/module/program/css/browse.css
@@ -25,3 +25,5 @@
#cards .project-detail .progress-text-left .progress-text {width: 50px; left: -50px;}
#cards .pager {margin: 0; float: right;}
#cards .pager .btn{border: none}
+
+.w-215px{width:215px;}
diff --git a/module/program/js/create.js b/module/program/js/create.js
index 425ec369fd..fe5ee350f0 100644
--- a/module/program/js/create.js
+++ b/module/program/js/create.js
@@ -3,7 +3,7 @@ $(function()
$('#copyProjects a').click(function(){setCopyProject($(this).data('id')); $('#copyProjectModal').modal('hide')});
});
-function setCopyProject(programID)
+function setCopyProject(copiedProgramID)
{
- location.href = createLink('program', 'create', 'template=' + template + '©ProgramID=' + programID);
+ location.href = createLink('program', 'create', 'template=' + template + '&programID=' + programID + '©ProgramID=' + copiedProgramID);
}
diff --git a/module/program/lang/zh-cn.php b/module/program/lang/zh-cn.php
index 5a732e57ea..2283c9cc38 100644
--- a/module/program/lang/zh-cn.php
+++ b/module/program/lang/zh-cn.php
@@ -41,6 +41,7 @@ $lang->program->transfer = '进入项目';
$lang->program->setPlanduration = '设置工期';
$lang->program->export = '导出';
$lang->program->privway = '权限控制';
+$lang->program->children = '子项目';
$lang->program->manageGroupMember = '维护分组用户';
$lang->program->durationEstimation = '工作量估算';
@@ -82,3 +83,4 @@ $lang->program->scrumDesc = '简介:小步迭代,
$lang->program->cmmi = '瀑布';
$lang->program->cmmiTitle = '瀑布式项目管理';
$lang->program->cmmiDesc = '简介:按阶段规范化管理
包含功能点:估算、计划、阶段、报告';
+$lang->program->cannotCreateChild = '该项目已经有实际的内容,无法直接添加子项目。您可以为当前项目创建一个父项目,然后在新的父项目下面添加子项目。';
diff --git a/module/program/model.php b/module/program/model.php
index fbc5b19ca7..3df689e5ce 100644
--- a/module/program/model.php
+++ b/module/program/model.php
@@ -5,6 +5,7 @@ class programModel extends model
{
return $this->dao->select('*')->from(TABLE_PROJECT)
->where('iscat')->eq(0)
+ ->andWhere('template')->ne('')
->andWhere('program')->eq(0)
->andWhere('deleted')->eq(0)
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->programs)->fi()
@@ -93,6 +94,12 @@ class programModel extends model
$this->dao->update(TABLE_PROJECT)->set('`order`')->eq($programID * 5)->where('id')->eq($programID)->exec();
$this->file->updateObjectID($this->post->uid, $programID, 'project');
+ if($project->parent > 0)
+ {
+ $this->dao->update(TABLE_PROJECT)->set('isCat')->eq(1)->where('id')->eq($project->parent)->exec();
+ $this->fixPath($programID);
+ }
+
/* Add program admin.*/
$groupPriv = $this->dao->select('t1.*')->from(TABLE_USERGROUP)->alias('t1')
->leftJoin(TABLE_GROUP)->alias('t2')->on('t1.group = t2.id')
@@ -189,4 +196,49 @@ class programModel extends model
{
return $this->dao->select('*')->from(TABLE_PRODUCT)->where('project')->eq($program)->fetchAll('id');
}
+
+ public function checkHasContent($programID)
+ {
+ $count = 0;
+ $count += $this->dao->select('count(*) as count')->from(TABLE_BUDGET)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_BUG)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_CASE)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_DESIGN)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_DOC)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_DURATIONESTIMATION)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_ISSUE)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_PROJECT)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_RELATION)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_RELEASE)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_REPO)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_RISK)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_STORY)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_TESTREPORT)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_TESTSUITE)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_TESTTASK)->where('program')->eq($programID)->fetch('count');
+ $count += $this->dao->select('count(*) as count')->from(TABLE_WORKESTIMATION)->where('program')->eq($programID)->fetch('count');
+
+ return $count > 0;
+ }
+
+ public function fixPath($programID)
+ {
+ $path = array();
+ $program = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($programID)->fetch();
+ if($program->parent == 0)
+ {
+ $path['path'] = ",{$program->id},";
+ $path['grade'] = 1;
+ $this->dao->update(TABLE_PROJECT)->set('path')->eq($path['path'])->set('grade')->eq($path['grade'])->where('id')->eq($program->id)->exec();
+ }
+ else
+ {
+ $path = $this->fixPath($program->parent);
+ $path['path'] .= "{$program->id},";
+ $path['grade'] += 1;
+ $this->dao->update(TABLE_PROJECT)->set('path')->eq($path['path'])->set('grade')->eq($path['grade'])->where('id')->eq($program->id)->exec();
+ }
+
+ return $path;
+ }
}
diff --git a/module/program/view/browsebylist.html.php b/module/program/view/browsebylist.html.php
index d2dfb5103c..50a3b1bd92 100644
--- a/module/program/view/browsebylist.html.php
+++ b/module/program/view/browsebylist.html.php
@@ -14,7 +14,7 @@
program->end);?> |
program->budget);?> |
program->PM);?> |
- actions;?> |
+ actions;?> |
project->orderAB);?> |
@@ -43,6 +43,7 @@
id", $project, 'list', '', '', 'iframe', true);?>
id", $project, 'list', '', '', 'iframe', true);?>
createLink("program", "edit", "projectID=$project->id"), "", '', "class='btn' title='{$lang->edit}'");?>
+ id", '', 'list', 'treemap-alt', '', '', '', '', $this->lang->program->children);?>
|
diff --git a/module/program/view/create.html.php b/module/program/view/create.html.php
index c2dab91696..31e10e94af 100644
--- a/module/program/view/create.html.php
+++ b/module/program/view/create.html.php
@@ -101,7 +101,7 @@
| project->status;?> |
|
- |
+ |
|
|
@@ -129,6 +129,10 @@
+
|
@@ -165,4 +169,5 @@
+