diff --git a/db/update18.3.sql b/db/update18.3.sql index abd6f921da..c51ca3a762 100644 --- a/db/update18.3.sql +++ b/db/update18.3.sql @@ -462,6 +462,10 @@ ALTER TABLE `zt_durationestimation` CHANGE `editedBy` `editedBy` varchar(30) NOT NULL DEFAULT '', CHANGE `editedDate` `editedDate` datetime NULL; +ALTER TABLE `zt_effort` +CHANGE `begin` `begin` smallint(4) unsigned zerofill NOT NULL DEFAULT '0', +CHANGE `end` `end` smallint(4) unsigned zerofill NOT NULL DEFAULT '0'; + ALTER TABLE `zt_entry` CHANGE `editedBy` `editedBy` varchar(30) NOT NULL DEFAULT '', CHANGE `editedDate` `editedDate` datetime NULL; @@ -560,6 +564,7 @@ CHANGE `activatedDate` `activatedDate` datetime NULL; ALTER TABLE `zt_kanbancard` CHANGE `begin` `begin` date NULL, CHANGE `end` `end` date NULL, +CHANGE `whitelist` `whitelist` text NULL, CHANGE `lastEditedBy` `lastEditedBy` char(30) NOT NULL DEFAULT '', CHANGE `lastEditedDate` `lastEditedDate` datetime NULL, CHANGE `archivedBy` `archivedBy` char(30) NOT NULL DEFAULT '', @@ -819,6 +824,8 @@ CHANGE `reviewDate` `reviewDate` datetime NULL; ALTER TABLE `zt_task` CHANGE `designVersion` `designVersion` smallint unsigned NOT NULL DEFAULT '1', CHANGE `feedback` `feedback` mediumint unsigned NOT NULL DEFAULT '0', +CHANGE `mode` `mode` varchar(10) NOT NULL DEFAULT '', +CHANGE `deadline` `deadline` date NULL, CHANGE `consumed` `consumed` float unsigned NOT NULL DEFAULT '0', CHANGE `assignedDate` `assignedDate` datetime NULL, CHANGE `planDuration` `planDuration` int NOT NULL DEFAULT '0', @@ -845,6 +852,10 @@ CHANGE `lastEditedBy` `lastEditedBy` varchar(30) NOT NULL DEFAULT '', CHANGE `lastEditedDate` `lastEditedDate` datetime NULL, CHANGE `activatedDate` `activatedDate` datetime NULL; +ALTER TABLE `zt_taskspec` +CHANGE `estStarted` `estStarted` date NULL, +CHANGE `deadline` `deadline` date NULL; + ALTER TABLE `zt_team` CHANGE `position` `position` varchar(30) NOT NULL DEFAULT '', CHANGE `join` `join` date NULL; diff --git a/db/zentao.sql b/db/zentao.sql index cb8c4047af..ab4e967fa5 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -751,8 +751,8 @@ CREATE TABLE IF NOT EXISTS `zt_effort` ( `date` date NOT NULL, `left` float NOT NULL, `consumed` float NOT NULL, - `begin` smallint(4) unsigned zerofill NOT NULL, - `end` smallint(4) unsigned zerofill NOT NULL, + `begin` smallint(4) unsigned zerofill NOT NULL DEFAULT '0', + `end` smallint(4) unsigned zerofill NOT NULL DEFAULT '0', `extra` text, `order` tinyint(3) unsigned NOT NULL DEFAULT '0', `deleted` enum('0','1') NOT NULL DEFAULT '0', @@ -994,7 +994,7 @@ CREATE TABLE IF NOT EXISTS `zt_kanbancard` ( `progress` float unsigned NOT NULL DEFAULT '0', `color` char(7) NOT NULL, `acl` char(30) NOT NULL DEFAULT 'open', - `whitelist` text NOT NULL, + `whitelist` text NULL, `order` mediumint(8) NOT NULL DEFAULT '0', `archived` enum('0', '1') NOT NULL DEFAULT '0', `createdBy` char(30) NOT NULL, @@ -1677,12 +1677,12 @@ CREATE TABLE IF NOT EXISTS `zt_task` ( `fromIssue` mediumint(8) unsigned NOT NULL DEFAULT '0', `name` varchar(255) NOT NULL, `type` varchar(20) NOT NULL, - `mode` varchar(10) NOT NULL, + `mode` varchar(10) NOT NULL DEFAULT '', `pri` tinyint(3) unsigned NOT NULL DEFAULT '0', `estimate` float unsigned NOT NULL, `consumed` float unsigned NOT NULL DEFAULT '0', `left` float unsigned NOT NULL, - `deadline` date NOT NULL, + `deadline` date NULL, `status` enum('wait','doing','done','pause','cancel','closed') NOT NULL DEFAULT 'wait', `subStatus` varchar(30) NOT NULL DEFAULT '', `color` char(7) NOT NULL, @@ -1742,8 +1742,8 @@ CREATE TABLE IF NOT EXISTS `zt_taskspec` ( `task` mediumint(8) NOT NULL, `version` smallint(6) NOT NULL, `name` varchar(255) NOT NULL, - `estStarted` date NOT NULL, - `deadline` date NOT NULL + `estStarted` date NULL, + `deadline` date NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE UNIQUE INDEX `task` ON `zt_taskspec`(`task`,`version`); -- DROP TABLE IF EXISTS `zt_taskteam`; diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index 3cb1cc1ad5..36df88473f 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -327,6 +327,21 @@ class baseDAO return $this->query("SHOW TABLES")->fetchAll(PDO::FETCH_ASSOC); } + /** + * Get table engines. + * + * @access public + * @return array + */ + public function getTableEngines() + { + $tables = $this->query("SHOW TABLE STATUS WHERE `Engine` is not null")->fetchAll(); + $tableEngines = array(); + foreach($tables as $table) $tableEngines[$table->Name] = $table->Engine; + + return $tableEngines; + } + /** * Desc table, show fields. * diff --git a/lib/dao/dm.class.php b/lib/dao/dm.class.php index 62f1b4da39..feff0f2812 100644 --- a/lib/dao/dm.class.php +++ b/lib/dao/dm.class.php @@ -44,6 +44,22 @@ class dm extends dao return $this->query($sql)->fetchAll(PDO::FETCH_ASSOC); } + /** + * Get table engines. + * + * @access public + * @return array + */ + public function getTableEngines() + { + $tables = $this->query("SELECT \"table_name\" FROM all_tables WHERE OWNER = '{$this->config->db->name}'")->fetchAll(); + + $tableEngines = array(); + foreach($tables as $table) $tableEngines[$table->table_name] = 'InnoDB'; + + return $tableEngines; + } + /** * 类MySQL的DESC语法。 * Desc table, show fields. diff --git a/module/admin/control.php b/module/admin/control.php index 8c997f4a7b..265506202a 100755 --- a/module/admin/control.php +++ b/module/admin/control.php @@ -477,7 +477,7 @@ class admin extends control public function tableEngine() { $this->view->title = $this->lang->admin->tableEngine; - $this->view->tableEngines = $this->loadModel('misc')->getTableEngines(); + $this->view->tableEngines = $this->dao->getTableEngines(); $this->display(); } diff --git a/module/misc/model.php b/module/misc/model.php index 67319d0baa..47405960ad 100644 --- a/module/misc/model.php +++ b/module/misc/model.php @@ -134,19 +134,4 @@ class miscModel extends model return $weakSites; } - - /** - * Get table and engine pairs. - * - * @access public - * @return array - */ - public function getTableEngines() - { - $tableEngines = array(); - $stmt = $this->dao->query("SHOW TABLE STATUS WHERE `Engine` is not null"); - while($table = $stmt->fetch()) $tableEngines[$table->Name] = $table->Engine; - - return $tableEngines; - } } diff --git a/module/task/model.php b/module/task/model.php index a5483a9a19..86de28ea70 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -35,8 +35,8 @@ class taskModel extends model } $executionID = (int)$executionID; - $estStarted = '0000-00-00'; - $deadline = '0000-00-00'; + $estStarted = null; + $deadline = null; $assignedTo = ''; $taskIdList = array(); $taskDatas = array(); @@ -113,8 +113,6 @@ class taskModel extends model ->setDefault('project', $this->getProjectID($executionID)) ->setIF($this->post->estimate != false, 'left', $this->post->estimate) ->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) - ->setDefault('estStarted', '0000-00-00') - ->setDefault('deadline', '0000-00-00') ->setIF(strpos($requiredFields, 'estStarted') !== false, 'estStarted', helper::isZeroDate($this->post->estStarted) ? '' : $this->post->estStarted) ->setIF(strpos($requiredFields, 'deadline') !== false, 'deadline', helper::isZeroDate($this->post->deadline) ? '' : $this->post->deadline) ->setIF(strpos($requiredFields, 'estimate') !== false, 'estimate', $this->post->estimate) @@ -205,8 +203,9 @@ class taskModel extends model $taskSpec->task = $taskID; $taskSpec->version = $task->version; $taskSpec->name = $task->name; - $taskSpec->estStarted = $task->estStarted; - $taskSpec->deadline = $task->deadline; + + if($task->estStarted) $taskSpec->estStarted = $task->estStarted; + if($task->deadline) $taskSpec->deadline = $task->deadline; $this->dao->insert(TABLE_TASKSPEC)->data($taskSpec)->autoCheck()->exec(); if(dao::isError()) return false; @@ -353,8 +352,8 @@ class taskModel extends model $module = 0; $type = ''; $assignedTo = ''; - $estStarted = '0000-00-00'; - $deadline = '0000-00-00'; + $estStarted = null; + $deadline = null; /* Get task data. */ $extendFields = $this->getFlowExtendFields(); @@ -388,8 +387,8 @@ class taskModel extends model $data[$i]->name = $tasks->name[$i]; $data[$i]->desc = nl2br($tasks->desc[$i]); $data[$i]->pri = $tasks->pri[$i]; - $data[$i]->estimate = $tasks->estimate[$i]; - $data[$i]->left = $tasks->estimate[$i]; + $data[$i]->estimate = $tasks->estimate[$i] ? $tasks->estimate[$i] : 0; + $data[$i]->left = $tasks->estimate[$i] ? $tasks->estimate[$i] : 0; $data[$i]->project = $projectID; $data[$i]->execution = $executionID; $data[$i]->estStarted = $estStarted; @@ -482,8 +481,8 @@ class taskModel extends model $taskSpec->task = $taskID; $taskSpec->version = $task->version; $taskSpec->name = $task->name; - $taskSpec->estStarted = $task->estStarted; - $taskSpec->deadline = $task->deadline; + if($task->estStarted) $taskSpec->estStarted = $task->estStarted; + if($task->deadline) $taskSpec->deadline = $task->deadline; $this->dao->insert(TABLE_TASKSPEC)->data($taskSpec)->autoCheck()->exec(); if(dao::isError()) return false;