diff --git a/db/zentao.sql b/db/zentao.sql index d05177fe58..4ecc3b3137 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -203,6 +203,7 @@ CREATE TABLE IF NOT EXISTS `zt_bug` ( `caseVersion` smallint(6) NOT NULL DEFAULT '1', `result` mediumint(8) unsigned NOT NULL, `repo` mediumint(8) unsigned NOT NULL, + `mr` mediumint(8) unsigned NOT NULL, `entry` varchar(255) NOT NULL, `lines` varchar(10) NOT NULL, `v1` varchar(40) NOT NULL, @@ -1250,6 +1251,12 @@ CREATE TABLE IF NOT EXISTS `zt_task` ( `lastEditedBy` varchar(30) NOT NULL, `lastEditedDate` datetime NOT NULL, `activatedDate` date NOT NULL, + `repo` mediumint(8) unsigned NOT NULL, + `mr` mediumint(8) unsigned NOT NULL, + `entry` varchar(255) NOT NULL, + `lines` varchar(10) NOT NULL, + `v1` varchar(40) NOT NULL, + `v2` varchar(40) NOT NULL, `deleted` enum('0','1') NOT NULL default '0', PRIMARY KEY (`id`), KEY `execution` (`execution`), diff --git a/module/action/lang/en.php b/module/action/lang/en.php index 0262b979aa..f0923f5bb5 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -357,6 +357,7 @@ $lang->action->dynamicAction->release['notified'] = 'Notify Release'; $lang->action->dynamicAction->release['hidden'] = 'Hide Release'; $lang->action->dynamicAction->story['opened'] = 'Create Story'; +$lang->action->dynamicAction->story['importfromgitlab'] = "Issue associate create story"; $lang->action->dynamicAction->story['edited'] = 'Edit Story'; $lang->action->dynamicAction->story['activated'] = 'Activate Story'; $lang->action->dynamicAction->story['reviewed'] = 'Review Story'; @@ -397,6 +398,7 @@ $lang->action->dynamicAction->kanbanlane['moved'] = 'Move Swimlane'; $lang->action->dynamicAction->team['managedTeam'] = 'Manage Team'; $lang->action->dynamicAction->task['opened'] = 'Create Task'; +$lang->action->dynamicAction->task['importfromgitlab'] = "Issue associate create task"; $lang->action->dynamicAction->task['edited'] = 'Edit Task'; $lang->action->dynamicAction->task['commented'] = 'Task Comment'; $lang->action->dynamicAction->task['assigned'] = 'Assign Task'; @@ -430,6 +432,7 @@ $lang->action->dynamicAction->build['edited'] = 'Edit Build'; $lang->action->dynamicAction->build['deleted'] = 'Delete Build'; $lang->action->dynamicAction->bug['opened'] = 'Report Bug'; +$lang->action->dynamicAction->bug['importfromgitlab'] = "Issue associate create bug"; $lang->action->dynamicAction->bug['edited'] = 'Edit Bug'; $lang->action->dynamicAction->bug['activated'] = 'Activate Bug'; $lang->action->dynamicAction->bug['assigned'] = 'Assign Bug'; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index 40bc7d20d8..58fc5a8433 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -357,6 +357,7 @@ $lang->action->dynamicAction->release['notified'] = '通知发布'; $lang->action->dynamicAction->release['hidden'] = '隐藏发布'; $lang->action->dynamicAction->story['opened'] = "创建{$lang->SRCommon}"; +$lang->action->dynamicAction->story['importfromgitlab'] = "从Gitlab关联创建{$lang->SRCommon}"; $lang->action->dynamicAction->story['edited'] = "编辑{$lang->SRCommon}"; $lang->action->dynamicAction->story['activated'] = "激活{$lang->SRCommon}"; $lang->action->dynamicAction->story['reviewed'] = "评审{$lang->SRCommon}"; @@ -397,6 +398,7 @@ $lang->action->dynamicAction->kanbanlane['moved'] = '移动泳道'; $lang->action->dynamicAction->team['managedTeam'] = '维护团队'; $lang->action->dynamicAction->task['opened'] = '创建任务'; +$lang->action->dynamicAction->task['importfromgitlab'] = "从Gitlab关联创建任务"; $lang->action->dynamicAction->task['edited'] = '编辑任务'; $lang->action->dynamicAction->task['commented'] = '备注任务'; $lang->action->dynamicAction->task['assigned'] = '指派任务'; @@ -430,6 +432,7 @@ $lang->action->dynamicAction->build['edited'] = '编辑版本'; $lang->action->dynamicAction->build['deleted'] = '删除版本'; $lang->action->dynamicAction->bug['opened'] = '创建Bug'; +$lang->action->dynamicAction->bug['importfromgitlab'] = "从Gitlab关联创建Bug"; $lang->action->dynamicAction->bug['edited'] = '编辑Bug'; $lang->action->dynamicAction->bug['activated'] = '激活Bug'; $lang->action->dynamicAction->bug['assigned'] = '指派Bug'; diff --git a/module/gitlab/js/managegroupmembers.js b/module/gitlab/js/managegroupmembers.js index c67e34038e..a9391db43b 100644 --- a/module/gitlab/js/managegroupmembers.js +++ b/module/gitlab/js/managegroupmembers.js @@ -47,15 +47,19 @@ function deleteItem(obj) $(document).on('change', '[id^="levels"]', function() { + $tr = $(this).closest('tr'); $next = $(this).closest('td').next() - if($(this).val() == '50') + var ownerLevel = 50; + if($(this).val() == ownerLevel) { $next.prepend(''); $next.find('[id^="expires"]').addClass('hidden'); + $tr.find('a[onclick^="deleteItem"]').addClass('disabled'); } else { $next.find('[id^="expires"]').removeClass('hidden'); $next.find('input.disabled').remove(); + $tr.find('a[onclick^="deleteItem"]').removeClass('disabled'); } }) diff --git a/module/gitlab/view/managegroupmembers.html.php b/module/gitlab/view/managegroupmembers.html.php index 3821ad265d..08d5891c51 100644 --- a/module/gitlab/view/managegroupmembers.html.php +++ b/module/gitlab/view/managegroupmembers.html.php @@ -19,13 +19,14 @@
+| mr->reviewType;?> | -mr->reviewTypeList, 'bug', "class='form-control' onchange=changeReviewType(this)")?> | +mr->reviewType;?> | +mr->reviewTypeList, 'bug', "class='form-control' onchange=changeReviewType(this)")?> | ++ | |
|---|---|---|---|---|---|
| repo->product?> | -+ |
@@ -161,7 +163,7 @@ js::set('revision', '');
diff --git a/module/upgrade/model.php b/module/upgrade/model.php
index 3ee0d81265..479f87c305 100644
--- a/module/upgrade/model.php
+++ b/module/upgrade/model.php
@@ -735,6 +735,10 @@ class upgradeModel extends model
$this->updateObjectBranch();
$this->updateProjectStories();
$this->appendExec('15_7_1');
+ case '16_0_beta1':
+ $this->saveLogs('Execute 16_0_beta1');
+ $this->adjustPriv16_0_beta1();
+ $this->appendExec('16_0_beta1');
}
$this->deletePatch();
@@ -5404,4 +5408,24 @@ class upgradeModel extends model
return true;
}
+
+ /**
+ * Adjust priv 16_0_beta1.
+ *
+ * @access public
+ * @return bool
+ */
+ public function adjustPriv16_0_beta1()
+ {
+ $groups = $this->dao->select('`group`')->from(TABLE_GROUPPRIV)->where('module')->eq('mr')->andWhere('method')->eq('addBug')->fetchPairs('group', 'group');
+ foreach($groups as $groupID)
+ {
+ $groupPriv = new stdclass();
+ $groupPriv->group = $groupID;
+ $groupPriv->module = 'mr';
+ $groupPriv->method = 'addReview';
+ $this->dao->replace(TABLE_GROUPPRIV)->data($groupPriv)->exec();
+ }
+ return true;
+ }
}
diff --git a/test/model/mr/getdiffs.php b/test/model/mr/getdiffs.php
new file mode 100644
index 0000000000..dadb786506
--- /dev/null
+++ b/test/model/mr/getdiffs.php
@@ -0,0 +1,30 @@
+#!/usr/bin/env php
+> return null
+使用正确的MR >> return normal
+
+*/
+
+$mrModel = $tester->loadModel('mr');
+
+$MR = '';
+$result = $mrModel->getDiffs($MR);
+if(empty($result)) $result = 'return null';
+r($result) && p() && e('return null'); //使用空的MR
+
+$MR = $tester->dao->select('*')->from(TABLE_MR)->orderBy('id_desc')->limit(1)->fetch();
+$result = $mrModel->getDiffs($MR);
+if(!empty($result))
+{
+ $first = reset($result);
+ if(isset($first->fileName) and is_array($first->contents)) $result = 'return normal';
+}
+r($result) && p() && e('return normal'); //使用正确的MR
diff --git a/test/model/mr/getlastreviewinfo.php b/test/model/mr/getlastreviewinfo.php
new file mode 100644
index 0000000000..f09591e8a8
--- /dev/null
+++ b/test/model/mr/getlastreviewinfo.php
@@ -0,0 +1,26 @@
+#!/usr/bin/env php
+> return null
+使用正确的repoID >> return normal
+
+*/
+
+$mrModel = $tester->loadModel('mr');
+
+$repoID = 0;
+$result = $mrModel->getLastReviewInfo($repoID);
+if(empty($result)) $result = 'return null';
+r($result) && p() && e('return null'); //使用空的repoID
+
+$repo = $tester->dao->select('*')->from(TABLE_REPO)->orderBy('id_desc')->limit(1)->fetch();
+$result = $mrModel->getLastReviewInfo($repo->id);
+if(isset($result->bug) and isset($result->task)) $result = 'return normal';
+r($result) && p() && e('return normal'); //使用正确的repoID
diff --git a/test/model/mr/getreview.php b/test/model/mr/getreview.php
new file mode 100644
index 0000000000..adb4f46df4
--- /dev/null
+++ b/test/model/mr/getreview.php
@@ -0,0 +1,41 @@
+#!/usr/bin/env php
+> return null
+使用正确的repoID, MRID >> return normal
+使用正确的repoID, MRID, 错误的revision >> return null
+
+*/
+
+$mrModel = $tester->loadModel('mr');
+
+$repoID = 0;
+$MRID = 0;
+$revision = '';
+
+$result = $mrModel->getReview($repoID, $MRID, $revision);
+if(empty($result)) $result = 'return null';
+r($result) && p() && e('return null'); //使用空的repoID, MRID, revision
+
+$MR = $tester->dao->select('*')->from(TABLE_MR)->orderBy('id_desc')->limit(1)->fetch();
+$repoID = $MR->repoID;
+$MRID = $MR->id;
+$result = $mrModel->getReview($repoID, $MRID, $revision);
+if(!empty($result))
+{
+ $first = reset($result);
+ if(isset($first['bug']) or isset($first['task'])) $result = 'return normal';
+}
+r($result) && p() && e('return normal'); //使用正确的repoID, MRID
+
+$revision = '123qwe';
+$result = $mrModel->getReview($repoID, $MRID, $revision);
+if(empty($result)) $result = 'return null';
+r($result) && p() && e('return null'); //使用正确的repoID, MRID, 错误的revision
diff --git a/test/model/mr/savebug.php b/test/model/mr/savebug.php
new file mode 100644
index 0000000000..db9118a8ec
--- /dev/null
+++ b/test/model/mr/savebug.php
@@ -0,0 +1,44 @@
+#!/usr/bin/env php
+> return false
+使用正确的repoID, MRID。空的title。 >> return false
+使用正确的repoID, MRID。POST数据正确。 >> Test Bug Review
+
+*/
+
+$mrModel = $tester->loadModel('mr');
+
+$_POST = array();
+$_POST['title'] = 'Test Bug Review';
+$_POST['commentText'] = 'Test Bug Review';
+$_POST['module'] = '1';
+$_POST['begin'] = '8';
+$_POST['end'] = '8';
+$_POST['product'] = '1';
+$_POST['assignedTo'] = '';
+
+$repoID = 0;
+$MRID = 0;
+$v1 = 0;
+$v2 = '';
+$result = $mrModel->saveBug($repoID, $MRID, $v1, $v2);
+if($result['result'] == 'fail' and isset($result['message']['mr']) and isset($result['message']['repo'])) $result = 'return false';
+r($result) && p() && e('return false'); //使用空的repoID, MRID
+
+$_POST['title'] = '';
+$MR = $tester->dao->select('*')->from(TABLE_MR)->orderBy('id_desc')->limit(1)->fetch();
+$result = $mrModel->saveBug($MR->repoID, $MR->id, $v1, $v2);
+if($result['result'] == 'fail' and isset($result['message']['title'])) $result = 'return false';
+r($result) && p() && e('return false'); //使用正确的repoID, MRID。空的title。
+
+$_POST['title'] = 'Test Bug Review';
+$result = $mrModel->saveBug($MR->repoID, $MR->id, $v1, $v2);
+r($result) && p('title') && e('Test Bug Review'); //使用正确的repoID, MRID。POST数据正确。
diff --git a/test/model/mr/savetask.php b/test/model/mr/savetask.php
new file mode 100644
index 0000000000..5889dd4902
--- /dev/null
+++ b/test/model/mr/savetask.php
@@ -0,0 +1,45 @@
+#!/usr/bin/env php
+> return false
+使用正确的repoID, MRID。空的title。 >> return false
+使用正确的repoID, MRID。POST数据正确。 >> Test Task Review
+
+*/
+
+$mrModel = $tester->loadModel('mr');
+
+$_POST = array();
+$_POST['title'] = 'Test Task Review';
+$_POST['commentText'] = 'Test Task Review';
+$_POST['taskModule'] = '1';
+$_POST['taskExecution'] = '1';
+$_POST['begin'] = '8';
+$_POST['end'] = '8';
+$_POST['taskAssignedTo'] = '';
+$_POST['entry'] = '';
+
+$repoID = 0;
+$MRID = 0;
+$v1 = 0;
+$v2 = '';
+$result = $mrModel->saveTask($repoID, $MRID, $v1, $v2);
+if($result['result'] == 'fail' and isset($result['message']['mr']) and isset($result['message']['repo'])) $result = 'return false';
+r($result) && p() && e('return false'); //使用空的repoID, MRID
+
+$_POST['title'] = '';
+$MR = $tester->dao->select('*')->from(TABLE_MR)->orderBy('id_desc')->limit(1)->fetch();
+$result = $mrModel->saveTask($MR->repoID, $MR->id, $v1, $v2);
+if($result['result'] == 'fail' and isset($result['message']['name'])) $result = 'return false';
+r($result) && p() && e('return false'); //使用正确的repoID, MRID。空的title。
+
+$_POST['title'] = 'Test Task Review';
+$result = $mrModel->saveTask($MR->repoID, $MR->id, $v1, $v2);
+r($result) && p('title') && e('Test Task Review'); //使用正确的repoID, MRID。POST数据正确。
|