* Add unit test for afterSplitTask and optimized some codes.
This commit is contained in:
@@ -3855,15 +3855,16 @@ class taskModel extends model
|
||||
{
|
||||
$parentID = (int)$oldParentTask->id;
|
||||
|
||||
/* 当一个普通任务有消耗时,拆分子任务。 */
|
||||
/* When common task are child tasks and the common task has consumption, create a child task. */
|
||||
/* 当一个普通任务有消耗时,拆分子任务并更新父任务状态。 */
|
||||
/* When a normal task is consumed, create the subtask and update the parent task status. */
|
||||
if($oldParentTask->parent == 0 and $oldParentTask->consumed > 0)
|
||||
{
|
||||
$taskID = $this->taskTao->splitConsumedTask($oldParentTask);
|
||||
if(!$taskID) return false;
|
||||
if(!$taskID) return false;
|
||||
|
||||
$this->updateParentStatus($taskID);
|
||||
}
|
||||
|
||||
$this->updateParentStatus($taskID);
|
||||
$this->computeBeginAndEnd($parentID);
|
||||
$this->taskTao->updateParentAfterSplit($parentID);
|
||||
|
||||
@@ -3877,7 +3878,7 @@ class taskModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量创建任务后的其他数据处理。
|
||||
* 批量创建任务后的看板数据处理。
|
||||
* Kanban data processing after batch create tasks.
|
||||
*
|
||||
* @param int $taskID
|
||||
|
||||
+9
-7
@@ -192,10 +192,12 @@ class taskTao extends taskModel
|
||||
* 通过任务类型查找用户的任务。
|
||||
* Fetch user tasks by type.
|
||||
*
|
||||
* @param string $account
|
||||
* @param string $type assignedTo|finishedBy|closedBy
|
||||
* @param string $orderBy
|
||||
* @param int $projectID
|
||||
* @param string $account
|
||||
* @param string $type assignedTo|finishedBy|closedBy
|
||||
* @param string $orderBy
|
||||
* @param int $projectID
|
||||
* @param int $limit
|
||||
* @param object|null $pager
|
||||
* @access protected
|
||||
* @return object[]
|
||||
*/
|
||||
@@ -592,9 +594,9 @@ class taskTao extends taskModel
|
||||
*
|
||||
* @param object $parentTask
|
||||
* @access protected
|
||||
* @return bool
|
||||
* @return bool|int
|
||||
*/
|
||||
protected function splitConsumedTask(object $parentTask): bool
|
||||
protected function splitConsumedTask(object $parentTask): bool|int
|
||||
{
|
||||
$clonedTask = clone $parentTask;
|
||||
$clonedTask->parent = $parentTask->id;
|
||||
@@ -610,7 +612,7 @@ class taskTao extends taskModel
|
||||
->exec();
|
||||
if(dao::isError()) return false;
|
||||
|
||||
return $clonedTaskID;
|
||||
return (int)$clonedTaskID;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/task.class.php';
|
||||
su('admin');
|
||||
|
||||
zdTable('task')->config('task')->gen(8);
|
||||
zdTable('action')->config('action')->gen(1);
|
||||
|
||||
/**
|
||||
|
||||
title=taskModel->updateKanban4BatchCreate();
|
||||
timeout=0
|
||||
cid=2
|
||||
|
||||
*/
|
||||
|
||||
$parentIdList = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
|
||||
$task = new taskTest();
|
||||
|
||||
r($task->afterSplitTaskTest($parentIdList[1], '2', 'children')) && p('9') && e('9'); // 测试如果父任务有工时消耗时是否成功克隆子任务。
|
||||
r($task->afterSplitTaskTest($parentIdList[1], '2', 'parent')) && p('status') && e('doing'); // 测试父任务状态是否改变。
|
||||
r($task->afterSplitTaskTest($parentIdList[3], '4', 'parentAction')) && p('actionID') && e('5'); // 测试父任务动态是否创建成功。
|
||||
r($task->afterSplitTaskTest($parentIdList[3], '4', 'parentEstStarted')) && p() && e('2021-01-09'); // 测试父任务预计开始时间是否更新。
|
||||
r($task->afterSplitTaskTest($parentIdList[3], '4', 'parentDeadline')) && p() && e('2021-01-23'); // 测试父任务截止时间是否更新。
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
fields:
|
||||
- field: objectType
|
||||
note: 对象类型
|
||||
range: task
|
||||
...
|
||||
@@ -0,0 +1,68 @@
|
||||
-- MySQL dump 10.13 Distrib 8.0.32, for Linux (x86_64)
|
||||
--
|
||||
-- Host: 127.0.0.1 Database: zentaopms_unittest
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 8.0.32-0ubuntu0.20.04.2
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!50503 SET NAMES utf8mb4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `zt_action`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `zt_action`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `zt_action` (
|
||||
`id` int unsigned NOT NULL AUTO_INCREMENT,
|
||||
`objectType` varchar(30) NOT NULL DEFAULT '',
|
||||
`objectID` mediumint unsigned NOT NULL DEFAULT '0',
|
||||
`product` text NOT NULL,
|
||||
`project` mediumint unsigned NOT NULL DEFAULT '0',
|
||||
`execution` mediumint unsigned NOT NULL DEFAULT '0',
|
||||
`actor` varchar(100) NOT NULL DEFAULT '',
|
||||
`action` varchar(80) NOT NULL DEFAULT '',
|
||||
`date` datetime DEFAULT NULL,
|
||||
`comment` text NOT NULL,
|
||||
`extra` text,
|
||||
`read` enum('0','1') NOT NULL DEFAULT '0',
|
||||
`vision` varchar(10) NOT NULL DEFAULT 'rnd',
|
||||
`efforted` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `date` (`date`),
|
||||
KEY `actor` (`actor`),
|
||||
KEY `project` (`project`),
|
||||
KEY `action` (`action`),
|
||||
KEY `objectID` (`objectID`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `zt_action`
|
||||
--
|
||||
|
||||
LOCK TABLES `zt_action` WRITE;
|
||||
/*!40000 ALTER TABLE `zt_action` DISABLE KEYS */;
|
||||
INSERT INTO `zt_action` VALUES (1,'task',0,'',0,0,'','',NULL,'',NULL,'0','rnd',0),(2,'task',1,',1,',11,101,'admin','edited','2023-05-08 19:47:48','','','0','rnd',0),(3,'task',1,',1,',11,101,'admin','createchildren','2023-05-08 19:47:48','','2','0','rnd',0),(4,'user',1,',0,',0,0,'admin','login','2023-05-08 19:49:15','','','0','rnd',0);
|
||||
/*!40000 ALTER TABLE `zt_action` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2023-05-08 11:49:15
|
||||
@@ -0,0 +1,108 @@
|
||||
-- MySQL dump 10.13 Distrib 8.0.32, for Linux (x86_64)
|
||||
--
|
||||
-- Host: 127.0.0.1 Database: zentaopms_unittest
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 8.0.32-0ubuntu0.20.04.2
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!50503 SET NAMES utf8mb4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `zt_task`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `zt_task`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!50503 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `zt_task` (
|
||||
`id` mediumint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`project` mediumint unsigned NOT NULL DEFAULT '0',
|
||||
`parent` mediumint NOT NULL DEFAULT '0',
|
||||
`execution` mediumint unsigned NOT NULL DEFAULT '0',
|
||||
`module` mediumint unsigned NOT NULL DEFAULT '0',
|
||||
`design` mediumint unsigned NOT NULL DEFAULT '0',
|
||||
`story` mediumint unsigned NOT NULL DEFAULT '0',
|
||||
`storyVersion` smallint NOT NULL DEFAULT '1',
|
||||
`designVersion` smallint unsigned NOT NULL DEFAULT '1',
|
||||
`fromBug` mediumint unsigned NOT NULL DEFAULT '0',
|
||||
`feedback` mediumint unsigned NOT NULL DEFAULT '0',
|
||||
`fromIssue` mediumint unsigned NOT NULL DEFAULT '0',
|
||||
`name` varchar(255) NOT NULL DEFAULT '',
|
||||
`type` varchar(20) NOT NULL DEFAULT '',
|
||||
`mode` varchar(10) NOT NULL DEFAULT '',
|
||||
`pri` tinyint unsigned NOT NULL DEFAULT '0',
|
||||
`estimate` float unsigned NOT NULL,
|
||||
`consumed` float unsigned NOT NULL DEFAULT '0',
|
||||
`left` float unsigned NOT NULL,
|
||||
`deadline` date DEFAULT NULL,
|
||||
`status` enum('wait','doing','done','pause','cancel','closed') NOT NULL DEFAULT 'wait',
|
||||
`subStatus` varchar(30) NOT NULL DEFAULT '',
|
||||
`color` char(7) NOT NULL DEFAULT '',
|
||||
`mailto` text,
|
||||
`desc` mediumtext NOT NULL,
|
||||
`version` smallint NOT NULL DEFAULT '0',
|
||||
`openedBy` varchar(30) NOT NULL DEFAULT '',
|
||||
`openedDate` datetime DEFAULT NULL,
|
||||
`assignedTo` varchar(30) NOT NULL DEFAULT '',
|
||||
`assignedDate` datetime DEFAULT NULL,
|
||||
`estStarted` date DEFAULT NULL,
|
||||
`realStarted` datetime DEFAULT NULL,
|
||||
`finishedBy` varchar(30) NOT NULL DEFAULT '',
|
||||
`finishedDate` datetime DEFAULT NULL,
|
||||
`finishedList` text,
|
||||
`canceledBy` varchar(30) NOT NULL DEFAULT '',
|
||||
`canceledDate` datetime DEFAULT NULL,
|
||||
`closedBy` varchar(30) NOT NULL DEFAULT '',
|
||||
`closedDate` datetime DEFAULT NULL,
|
||||
`planDuration` int NOT NULL DEFAULT '0',
|
||||
`realDuration` int NOT NULL DEFAULT '0',
|
||||
`closedReason` varchar(30) NOT NULL DEFAULT '',
|
||||
`lastEditedBy` varchar(30) NOT NULL DEFAULT '',
|
||||
`lastEditedDate` datetime DEFAULT NULL,
|
||||
`activatedDate` datetime DEFAULT NULL,
|
||||
`order` mediumint unsigned NOT NULL DEFAULT '0',
|
||||
`repo` mediumint unsigned NOT NULL DEFAULT '0',
|
||||
`mr` mediumint unsigned NOT NULL DEFAULT '0',
|
||||
`entry` varchar(255) NOT NULL DEFAULT '',
|
||||
`lines` varchar(10) NOT NULL DEFAULT '',
|
||||
`v1` varchar(40) NOT NULL DEFAULT '',
|
||||
`v2` varchar(40) NOT NULL DEFAULT '',
|
||||
`deleted` enum('0','1') NOT NULL DEFAULT '0',
|
||||
`vision` varchar(10) NOT NULL DEFAULT 'rnd',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `execution` (`execution`),
|
||||
KEY `story` (`story`),
|
||||
KEY `parent` (`parent`),
|
||||
KEY `assignedTo` (`assignedTo`),
|
||||
KEY `order` (`order`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb3;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `zt_task`
|
||||
--
|
||||
|
||||
LOCK TABLES `zt_task` WRITE;
|
||||
/*!40000 ALTER TABLE `zt_task` DISABLE KEYS */;
|
||||
INSERT INTO `zt_task` VALUES (1,11,-1,101,21,0,1,1,0,0,0,0,'开发任务11','design','',1,0,3,0,'2023-05-15','wait','0','','','这里是任务描述1',1,'admin','2023-05-08 00:00:00','','2023-05-08 00:00:00','2023-05-08','2023-05-08 00:00:00','',NULL,'','',NULL,'',NULL,1,1,'','admin','2023-05-08 19:47:48',NULL,0,0,0,'','','','','0','rnd'),(2,12,0,102,24,0,5,1,0,0,0,0,'开发任务12','devel','',2,1,4,1,'2023-05-14','doing','0','','','这里是任务描述2',1,'admin','2023-05-08 00:00:00','','2023-05-08 00:00:00','2023-05-08','2023-05-08 00:00:00','',NULL,'','',NULL,'',NULL,1,1,'','',NULL,NULL,0,0,0,'','','','','0','rnd'),(3,13,0,103,27,0,9,1,0,0,0,0,'开发任务13','test','',3,2,5,2,'2023-05-13','done','0','','','这里是任务描述3',1,'admin','2023-05-08 00:00:00','','2023-05-08 00:00:00','2023-05-08','2023-05-08 00:00:00','',NULL,'','',NULL,'',NULL,1,1,'','',NULL,NULL,0,0,0,'','','','','0','rnd'),(4,14,0,104,30,0,13,1,0,0,0,0,'开发任务14','study','',4,3,6,3,'2023-05-12','pause','0','','','这里是任务描述4',1,'admin','2023-05-08 00:00:00','','2023-05-08 00:00:00','2023-05-08','2023-05-08 00:00:00','',NULL,'','',NULL,'',NULL,1,1,'','',NULL,NULL,0,0,0,'','','','','0','rnd'),(5,15,0,105,33,0,17,1,0,0,0,0,'开发任务15','discuss','',1,4,7,4,'2023-05-11','cancel','0','','','这里是任务描述5',1,'admin','2023-05-08 00:00:00','','2023-05-08 00:00:00','2023-05-08','2023-05-08 00:00:00','',NULL,'','',NULL,'',NULL,1,1,'','',NULL,NULL,0,0,0,'','','','','0','rnd'),(6,16,0,106,36,0,21,1,0,0,0,0,'开发任务16','ui','',2,5,8,5,'2023-05-10','closed','0','','','这里是任务描述6',1,'admin','2023-05-08 00:00:00','','2023-05-08 00:00:00','2023-05-08','2023-05-08 00:00:00','',NULL,'','',NULL,'',NULL,1,1,'','',NULL,NULL,0,0,0,'','','','','0','rnd'),(7,17,0,107,39,0,25,1,0,0,0,0,'开发任务17','affair','',3,6,9,6,'2023-05-09','wait','0','','','这里是任务描述7',1,'admin','2023-05-08 00:00:00','','2023-05-08 00:00:00','2023-05-08','2023-05-08 00:00:00','',NULL,'','',NULL,'',NULL,1,1,'','',NULL,NULL,0,0,0,'','','','','0','rnd'),(8,18,0,108,42,0,29,1,0,0,0,0,'开发任务18','misc','',4,7,10,7,'2023-05-08','doing','0','','','这里是任务描述8',1,'admin','2023-05-08 00:00:00','','2023-05-08 00:00:00','2023-05-08','2023-05-08 00:00:00','',NULL,'','',NULL,'',NULL,1,1,'','',NULL,NULL,0,0,0,'','','','','0','rnd'),(9,11,1,101,21,0,1,1,0,0,0,0,'开发任务11','design','',1,0,3,0,'2023-05-15','wait','0','','','这里是任务描述1',1,'admin','2023-05-08 00:00:00','','2023-05-08 00:00:00','2023-05-08','2023-05-08 00:00:00','','0000-00-00 00:00:00','','','0000-00-00 00:00:00','','0000-00-00 00:00:00',1,1,'','','0000-00-00 00:00:00','0000-00-00 00:00:00',0,0,0,'','','','','0','rnd');
|
||||
/*!40000 ALTER TABLE `zt_task` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2023-05-08 11:49:15
|
||||
@@ -0,0 +1,251 @@
|
||||
---
|
||||
fields:
|
||||
- field: id
|
||||
note: ID
|
||||
range: 1-10000
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: parent
|
||||
note: 父任务
|
||||
range: 0
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: project
|
||||
note: 所属项目
|
||||
range: 11-100
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: execution
|
||||
note: 所属执行
|
||||
range: 101-700
|
||||
- field: module
|
||||
note: 所属模块
|
||||
range: 21-1820:3
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: story
|
||||
note: 相关需求
|
||||
range: 1-400:4
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: design
|
||||
note: 相关设计
|
||||
range: 0
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: storyVersion
|
||||
note: 需求版本
|
||||
range: 1
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: designVersion
|
||||
note: 设计版本
|
||||
range: 0
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: fromBug
|
||||
note: 来源Bug
|
||||
range: 0
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: name
|
||||
note: 任务名称
|
||||
fields:
|
||||
- field: name1
|
||||
range: 开发任务
|
||||
- field: name2
|
||||
range: 11-700
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: type
|
||||
note: 任务类型
|
||||
range: design,devel,test,study,discuss,ui,affair,misc
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: pri
|
||||
note: 优先级
|
||||
range: 1-4
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: estimate
|
||||
note: 最初预计
|
||||
range: 0-10
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: consumed
|
||||
note: 总计消耗
|
||||
range: 3-12
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: left
|
||||
note: 预计剩余
|
||||
range: 0-10
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: deadline
|
||||
note: 截止日期
|
||||
range: (+1w)-(-1M):-1D
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
type: timestamp
|
||||
format: YY/MM/DD
|
||||
- field: status
|
||||
note: 任务状态
|
||||
range: wait,doing,done,pause,cancel,closed
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: subStatus
|
||||
note: 子状态
|
||||
range: 0
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: color
|
||||
note: 标题颜色
|
||||
range: ""
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: mailto
|
||||
note: 抄送给
|
||||
range: ""
|
||||
- field: desc
|
||||
note: 任务描述
|
||||
range: 1-10000
|
||||
prefix: 这里是任务描述
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: version
|
||||
note: 版本号
|
||||
range: 1
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: openedBy
|
||||
note: 由谁创建
|
||||
range: admin
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: openedDate
|
||||
note: 创建日期
|
||||
range: (M)-(w)
|
||||
type: timestamp
|
||||
format: YY/MM/DD
|
||||
- field: assignedTo
|
||||
note: 指派给
|
||||
range: ""
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: assignedDate
|
||||
note: 指派日期
|
||||
range: (M)-(w)
|
||||
type: timestamp
|
||||
format: YY/MM/DD
|
||||
- field: estStarted
|
||||
note: 预计开始
|
||||
range: "2022-01-27"
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
type: timestamp
|
||||
format: YY/MM/DD
|
||||
- field: realStarted
|
||||
note: 实际开始
|
||||
range: (M)-(w)
|
||||
type: timestamp
|
||||
format: YY/MM/DD
|
||||
- field: finishedBy
|
||||
note: 由谁完成
|
||||
range: ""
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: finishedList
|
||||
note: 完成者列表
|
||||
range: ""
|
||||
- field: canceledBy
|
||||
note: 由谁取消
|
||||
range: ""
|
||||
- field: closedBy
|
||||
note: 由谁关闭
|
||||
range: ""
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: realDuration
|
||||
note: 实际持续时长
|
||||
range: 1
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: planDuration
|
||||
note: 计划持续时长
|
||||
range: 1
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: closedReason
|
||||
note: 关闭原因
|
||||
range: ""
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
- field: lastEditedBy
|
||||
note: 最后修改者
|
||||
range: ""
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
format: ""
|
||||
- field: deleted
|
||||
note: 是否删除
|
||||
range: 0
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
format: ""
|
||||
...
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/task.class.php';
|
||||
|
||||
function initData()
|
||||
|
||||
Regular → Executable
+1
-1
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/task.class.php';
|
||||
su('admin');
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
title: table zt_action
|
||||
author: mayue
|
||||
version: "1.0"
|
||||
fields:
|
||||
- field: objectType
|
||||
note: "对象类型"
|
||||
range: task
|
||||
@@ -0,0 +1,30 @@
|
||||
title: zt_task
|
||||
author: mayue
|
||||
version: "1.0"
|
||||
fields:
|
||||
- field: id
|
||||
range: 1-9
|
||||
- field: parent
|
||||
range: 0,1,0,2,0,3,0{3}
|
||||
- field: type
|
||||
range: devel{2},design,test,study,discuss,ui,affair,misc
|
||||
- field: status
|
||||
range: wait,doing
|
||||
- field: deleted
|
||||
range: 0
|
||||
- field: openedDate
|
||||
range: "20220101 000000:1W" # 生成从2021年1月1日0时0分0秒到当前时间的数据,步长为1周
|
||||
type: timestamp
|
||||
format: "YY/MM/DD hh:mm:ss"
|
||||
- field: consumed
|
||||
range: 1,0
|
||||
- field: story
|
||||
range: 0
|
||||
- field: estStarted
|
||||
range: "20210101 000000-20220101 230000:360000"
|
||||
type: timestamp
|
||||
format: "YY/MM/DD hh:mm:ss"
|
||||
- field: deadline
|
||||
range: "20210103 000000-20220101 230000:360000"
|
||||
type: timestamp
|
||||
format: "YY/MM/DD hh:mm:ss"
|
||||
@@ -1878,4 +1878,31 @@ class taskTest
|
||||
$lastTaskID = $tester->dao->select('objectID')->from(TABLE_ACTION)->where('objectType')->eq('task')->andWhere('action')->eq('Opened')->orderBy('`date` desc')->fetch('objectID');
|
||||
return $this->objectModel->getByID($lastTaskID);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拆分任务后更新其他数据。
|
||||
* Process other data after split task.
|
||||
*
|
||||
* @param int $oldParentTaskID
|
||||
* @param string $childTasks
|
||||
* @param string $testObject children|parent|parentAction
|
||||
* @access public
|
||||
* @return object|string
|
||||
*/
|
||||
public function afterSplitTaskTest($oldParentTaskID = 0, $childTasks = '', $testObject = 'parent')
|
||||
{
|
||||
global $tester;
|
||||
$_SERVER['HTTP_HOST'] = $tester->config->db->host;
|
||||
$oldParentTask = $tester->dao->select('*')->from(TABLE_TASK)->where('id')->eq($oldParentTaskID)->fetch();
|
||||
|
||||
$this->objectModel->afterSplitTask($oldParentTask, $childTasks);
|
||||
|
||||
$tasks['children'] = $tester->dao->select('id')->from(TABLE_TASK)->where('parent')->eq($oldParentTask->id)->fetchPairs('id');
|
||||
$tasks['parent'] = $tester->dao->select('*')->from(TABLE_TASK)->where('id')->eq($oldParentTask->id)->fetch();
|
||||
$tasks['parentAction'] = $tester->dao->select('id as actionID')->from(TABLE_ACTION)->where('objectID')->eq($oldParentTask->id)->andWhere('objectType')->eq('task')->fetch();
|
||||
$tasks['parentEstStarted'] = $tasks['parent']->estStarted;
|
||||
$tasks['parentDeadline'] = $tasks['parent']->deadline;
|
||||
|
||||
return $tasks[$testObject];
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -527,10 +527,10 @@ class taskZen extends task
|
||||
*
|
||||
* @param object $execution
|
||||
* @param object $formData
|
||||
* @access private
|
||||
* @return object[]
|
||||
* @access protected
|
||||
* @return object[]|false
|
||||
*/
|
||||
protected function prepareTasks4BatchCreate(object $execution, object $formData): array
|
||||
protected function prepareTasks4BatchCreate(object $execution, object $formData): array|false
|
||||
{
|
||||
/* 去除重复数据。 */
|
||||
$tasks = $this->removeDuplicate4BatchCreate($execution, $formData);
|
||||
@@ -1058,7 +1058,7 @@ class taskZen extends task
|
||||
* @param object $execution
|
||||
* @param string $action
|
||||
* @access protected
|
||||
* return array
|
||||
* @return array
|
||||
*/
|
||||
protected function getCustomFields(object $execution, string $action): array
|
||||
{
|
||||
@@ -1096,7 +1096,7 @@ class taskZen extends task
|
||||
*/
|
||||
protected function buildBatchCreateForm(object $execution, int $storyID, int $moduleID, int $taskID, array $output): void
|
||||
{
|
||||
/* 获取区域和泳道下拉数据,并设置区域和泳道的默认值。*/
|
||||
/* 获取区域和泳道下拉数据,并设置区域和泳道的默认值。 */
|
||||
if($execution->type == 'kanban') $this->showKanbanRelatedVars($execution->id, $output);
|
||||
|
||||
/* 任务拆解。 */
|
||||
|
||||
Reference in New Issue
Block a user