* Fix bugs in dmdb.

This commit is contained in:
朱金勇
2023-04-13 05:10:17 +00:00
parent 40e2ae98d5
commit bb531cfd2c
7 changed files with 45 additions and 23 deletions
+18 -1
View File
File diff suppressed because one or more lines are too long
+15 -15
View File
@@ -323,7 +323,7 @@ CREATE TABLE IF NOT EXISTS `zt_bug` (
-- DROP TABLE IF EXISTS `zt_build`;
CREATE TABLE IF NOT EXISTS `zt_build` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
`project` mediumint(8) unsigned NOT NULL,
`project` mediumint(8) unsigned NOT NULL default '0',
`product` mediumint(8) unsigned NOT NULL default '0',
`branch` varchar(255) NOT NULL DEFAULT '0',
`execution` mediumint(8) unsigned NOT NULL default '0',
@@ -358,9 +358,9 @@ CREATE TABLE IF NOT EXISTS `zt_burn` (
-- DROP TABLE IF EXISTS `zt_case`;
CREATE TABLE IF NOT EXISTS `zt_case` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
`project` mediumint(8) unsigned NOT NULL,
`project` mediumint(8) unsigned NOT NULL default '0',
`product` mediumint(8) unsigned NOT NULL default '0',
`execution` mediumint(8) unsigned NOT NULL,
`execution` mediumint(8) unsigned NOT NULL default '0',
`branch` mediumint(8) unsigned NOT NULL default '0',
`lib` mediumint(8) unsigned NOT NULL default '0',
`module` mediumint(8) unsigned NOT NULL default '0',
@@ -661,13 +661,13 @@ CREATE TABLE IF NOT EXISTS `zt_doc` (
`path` char(255) NOT NULL DEFAULT '',
`grade` tinyint(3) unsigned NOT NULL DEFAULT '0',
`order` smallint(5) unsigned NOT NULL DEFAULT '0',
`views` smallint(5) unsigned NOT NULL,
`views` smallint(5) unsigned NOT NULL DEFAULT '0',
`assetLib` mediumint(8) unsigned NOT NULL DEFAULT '0',
`assetLibType` varchar(30) NOT NULL DEFAULT '',
`from` mediumint(8) unsigned NOT NULL DEFAULT '0',
`fromVersion` smallint(6) NOT NULL DEFAULT '1',
`draft` longtext NOT NULL,
`collector` text NOT NULL,
`collector` text NULL,
`addedBy` varchar(30) NOT NULL,
`addedDate` datetime NOT NULL,
`assignedTo` varchar(30) NOT NULL DEFAULT '',
@@ -985,8 +985,8 @@ CREATE TABLE IF NOT EXISTS `zt_kanbancard` (
`pri` mediumint(8) unsigned NOT NULL,
`assignedTo` text NOT NULL,
`desc` mediumtext NOT NULL,
`begin` date NOT NULL,
`end` date NOT NULL,
`begin` date NULL,
`end` date NULL,
`estimate` float unsigned NOT NULL,
`progress` float unsigned NOT NULL DEFAULT '0',
`color` char(7) NOT NULL,
@@ -1095,8 +1095,8 @@ CREATE TABLE IF NOT EXISTS `zt_module` (
`order` smallint(5) unsigned NOT NULL default '0',
`type` char(30) NOT NULL,
`from` mediumint(8) unsigned NOT NULL default '0',
`owner` varchar(30) NOT NULL,
`collector` text NOT NULL,
`owner` varchar(30) NOT NULL DEFAULT '',
`collector` text NULL,
`short` varchar(30) NOT NULL DEFAULT '',
`deleted` enum('0','1') NOT NULL default '0',
PRIMARY KEY (`id`),
@@ -1592,12 +1592,12 @@ CREATE TABLE IF NOT EXISTS `zt_story` (
`closedDate` datetime NULL,
`closedReason` varchar(30) NOT NULL DEFAULT '',
`activatedDate` datetime NULL,
`toBug` mediumint(8) unsigned NOT NULL,
`childStories` varchar(255) NOT NULL,
`linkStories` varchar(255) NOT NULL,
`linkRequirements` varchar(255) NOT NULL,
`twins` varchar(255) NOT NULL,
`duplicateStory` mediumint(8) unsigned NOT NULL,
`toBug` mediumint(8) unsigned NOT NULL DEFAULT '0',
`childStories` varchar(255) NOT NULL DEFAULT '',
`linkStories` varchar(255) NOT NULL DEFAULT '',
`linkRequirements` varchar(255) NOT NULL DEFAULT '',
`twins` varchar(255) NOT NULL DEFAULT '',
`duplicateStory` mediumint(8) unsigned NOT NULL DEFAULT '0',
`version` smallint(6) NOT NULL DEFAULT '1',
`storyChanged` enum('0','1') NOT NULL DEFAULT '0',
`feedbackBy` varchar(100) NOT NULL DEFAULT '',
+2 -2
View File
@@ -219,7 +219,7 @@ class blockModel extends model
->orWhere('t3.status')->ne('suspended')
->markRight(1)
->andWhere('t1.status')->in('wait,doing')
->andWhere('t1.deadline')->ne('0000-00-00')
->andWhere('t1.deadline')->notZeroDate()
->andWhere('t1.deadline')->lt($today)
->andWhere('t1.deleted')->eq(0)
->andWhere('t3.deleted')->eq(0)
@@ -228,7 +228,7 @@ class blockModel extends model
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
->where('t1.assignedTo')->eq($this->app->user->account)
->andWhere('t1.status')->eq('active')
->andWhere('t1.deadline')->ne('0000-00-00')
->andWhere('t1.deadline')->notZeroDate()
->andWhere('t1.deadline')->lt($today)
->andWhere('t1.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)
+2 -1
View File
@@ -852,7 +852,7 @@ class docModel extends model
$now = helper::now();
$doc = fixer::input('post')
->callFunc('title', 'trim')
->setDefault('content', '')
->setDefault('content,template,templateType,chapterType', '')
->add('addedBy', $this->app->user->account)
->add('addedDate', $now)
->add('editedBy', $this->app->user->account)
@@ -891,6 +891,7 @@ class docModel extends model
$docContent->title = $doc->title;
$docContent->content = $doc->contentType == 'html' ? $doc->content : $doc->contentMarkdown;
$docContent->type = $doc->contentType;
$docContent->digest = '';
$docContent->version = 1;
unset($doc->contentMarkdown, $doc->contentType, $doc->url);
+5 -1
View File
@@ -483,7 +483,8 @@ class kanbanModel extends model
->add('assignedDate', $now)
->add('color', '#fff')
->trim('name,estimate')
->setDefault('estimate', 0)
->setDefault('estimate,fromID', 0)
->setDefault('fromType', '')
->stripTags($this->config->kanban->editor->createcard['id'], $this->config->allowedTags)
->join('assignedTo', ',')
->setIF(is_numeric($this->post->estimate), 'estimate', (float)$this->post->estimate)
@@ -504,6 +505,9 @@ class kanbanModel extends model
$card = $this->loadModel('file')->processImgURL($card, $this->config->kanban->editor->createcard['id'], $this->post->uid);
if(!$card->begin) unset($card->begin);
if(!$card->end) unset($card->end);
$this->dao->insert(TABLE_KANBANCARD)->data($card)->autoCheck()
->checkIF($card->estimate != '', 'estimate', 'float')
->batchCheck($this->config->kanban->createcard->requiredFields, 'notempty')
+2 -2
View File
@@ -1769,14 +1769,14 @@ class productModel extends model
$bugs = $this->dao->select('count(*) AS count')->from(TABLE_BUG)->where('product')->eq($productID)->andWhere('deleted')->eq(0)->fetch();
$docs = $this->dao->select('count(*) AS count')->from(TABLE_DOC)->where('product')->eq($productID)->andWhere('deleted')->eq(0)->fetch();
$releases = $this->dao->select('count(*) AS count')->from(TABLE_RELEASE)->where('deleted')->eq(0)->andWhere('product')->eq($productID)->fetch();
$projects = $this->dao->select('count("t1.*") AS count')->from(TABLE_PROJECTPRODUCT)->alias('t1')
$projects = $this->dao->select('count(*) AS count')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->where('t2.deleted')->eq(0)
->andWhere('t1.product')->eq($productID)
->andWhere('t2.type')->eq('project')
->fetch();
$executions = $this->dao->select('count("t1.*") AS count')->from(TABLE_PROJECTPRODUCT)->alias('t1')
$executions = $this->dao->select('count(*) AS count')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->where('t2.deleted')->eq(0)
->andWhere('t1.product')->eq($productID)
+1 -1
View File
@@ -1957,7 +1957,7 @@ class projectModel extends model
{
$beginTimeStamp = strtotime($project->begin);
$tasks = $this->dao->select('id,estStarted,deadline,status')->from(TABLE_TASK)
->where('deadline')->ne('0000-00-00')
->where('deadline')->notZeroDate()
->andWhere('status')->in('wait,doing')
->andWhere('project')->eq($projectID)
->fetchAll();