diff --git a/db/update17.4.sql b/db/update17.4.sql index 1ea0ae3fb6..9f41c86c8e 100644 --- a/db/update17.4.sql +++ b/db/update17.4.sql @@ -7,10 +7,15 @@ ALTER TABLE `zt_release` ADD `createdDate` datetime NOT NULL AFTER `createdBy`; ALTER TABLE `zt_testtask` ADD `createdBy` varchar(30) NOT NULL AFTER `subStatus`; ALTER TABLE `zt_testtask` ADD `createdDate` datetime NOT NULL AFTER `createdBy`; +ALTER TABLE `zt_build` ADD `createdBy` varchar(30) NOT NULL AFTER `desc`; +ALTER TABLE `zt_build` ADD `createdDate` datetime NOT NULL AFTER `createdBy`; + INSERT IGNORE INTO `zt_workflowfield` (`module`, `field`, `type`, `length`, `name`, `control`, `expression`, `options`, `default`, `rules`, `placeholder`, `order`, `searchOrder`, `exportOrder`, `canExport`, `canSearch`, `isValue`, `readonly`, `buildin`, `role`, `desc`, `createdBy`, `createdDate`, `editedBy`, `editedDate`) VALUES ('testtask', 'createdBy', 'varchar', '30', '由谁创建', 'select', '', 'user', '', '', '', 393, 0, 0, '0', '0', '0', '1', 1, 'buildin', '', '', '2022-08-02 14:49', '', '0000-00-00 00:00:00'), ('testtask', 'createdDate', 'datetime', '', '创建时间', 'datetime', '', '', '', '', '', 394, 0, 0, '0', '0', '0', '1', 1, 'buildin', '', '', '2022-08-02 14:49', '', '0000-00-00 00:00:00'), ('productplan', 'createdBy', 'varchar', '30', '由谁创建', 'select', '', 'user', '', '', '', 11, 0, 0, '0', '0', '0', '1', 1, 'buildin', '', '', '2022-08-02 14:49', '', '0000-00-00 00:00:00'), ('productplan', 'createdDate', 'datetime', '', '创建时间', 'datetime', '', '', '', '', '', 12, 0, 0, '0', '0', '0', '1', 1, 'buildin', '', '', '2022-08-02 14:49', '', '0000-00-00 00:00:00'), +('build', 'createdBy', 'varchar', '30', '由谁创建', 'select', '', 'user', '', '', '', 15, 0, 0, '0', '0', '0', '1', 1, 'buildin', '', '', '2022-08-02 14:49', '', '0000-00-00 00:00:00'), +('build', 'createdDate', 'datetime', '', '创建时间', 'datetime', '', '', '', '', '', 16, 0, 0, '0', '0', '0', '1', 1, 'buildin', '', '', '2022-08-02 14:49', '', '0000-00-00 00:00:00'), ('release', 'createdBy', 'varchar', '30', '由谁创建', 'select', '', 'user', '', '', '', 14, 0, 0, '0', '0', '0', '1', 1, 'buildin', '', '', '2022-08-02 14:49', '', '0000-00-00 00:00:00'), ('release', 'createdDate', 'datetime', '', '创建时间', 'datetime', '', '', '', '', '', 15, 0, 0, '0', '0', '0', '1', 1, 'buildin', '', '', '2022-08-02 14:49', '', '0000-00-00 00:00:00'); diff --git a/db/zentao.sql b/db/zentao.sql index 4f9bd2e718..5c15858844 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -331,6 +331,8 @@ CREATE TABLE IF NOT EXISTS `zt_build` ( `bugs` text NOT NULL, `builder` char(30) NOT NULL default '', `desc` mediumtext NOT NULL, + `createdBy` varchar(30) NOT NULL, + `createdDate` datetime NOT NULL, `deleted` enum('0','1') NOT NULL default '0', PRIMARY KEY (`id`), KEY `product` (`product`), diff --git a/module/bug/model.php b/module/bug/model.php index b3dce795ad..cf2ee943ea 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1124,13 +1124,15 @@ class bugModel extends model if(dao::isError()) return false; $buildData = new stdclass(); - $buildData->product = (int)$oldBug->product; - $buildData->branch = (int)$oldBug->branch; - $buildData->project = $this->dao->select('project')->from(TABLE_EXECUTION)->where('id')->eq($bug->buildExecution)->fetch('project'); - $buildData->execution = $bug->buildExecution; - $buildData->name = $bug->buildName; - $buildData->date = date('Y-m-d'); - $buildData->builder = $this->app->user->account; + $buildData->product = (int)$oldBug->product; + $buildData->branch = (int)$oldBug->branch; + $buildData->project = $this->dao->select('project')->from(TABLE_EXECUTION)->where('id')->eq($bug->buildExecution)->fetch('project'); + $buildData->execution = $bug->buildExecution; + $buildData->name = $bug->buildName; + $buildData->date = date('Y-m-d'); + $buildData->builder = $this->app->user->account; + $buildData->createdBy = $this->app->user->account; + $buildData->createdDate = helper::now(); $this->dao->insert(TABLE_BUILD)->data($buildData)->autoCheck() ->check('name', 'unique', "product = {$buildData->product} AND branch = {$buildData->branch} AND deleted = '0'") ->exec(); diff --git a/module/build/model.php b/module/build/model.php index 11815e9c3c..9debed159f 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -313,6 +313,8 @@ class buildModel extends model ->setDefault('branch', 0) ->cleanInt('product,branch') ->add('execution', (int)$executionID) + ->add('createdBy', $this->app->user->account) + ->add('createdDate', helper::now()) ->stripTags($this->config->build->editor->create['id'], $this->config->allowedTags) ->remove('resolvedBy,allchecker,files,labels,uid') ->get(); diff --git a/module/convert/model.php b/module/convert/model.php index 152fe6578b..dbb5055f98 100644 --- a/module/convert/model.php +++ b/module/convert/model.php @@ -947,11 +947,13 @@ class convertModel extends model $productID = $projectProduct[$projectID]; $build = new stdclass(); - $build->product = $productID; - $build->project = $projectID; - $build->name = $data->vname; - $build->date = substr($data->RELEASEDATE, 0, 10); - $build->builder = $this->app->user->account; + $build->product = $productID; + $build->project = $projectID; + $build->name = $data->vname; + $build->date = substr($data->RELEASEDATE, 0, 10); + $build->builder = $this->app->user->account; + $build->createdBy = $this->app->user->account; + $build->createdDate = helper::now(); $this->dao->dbh($this->dbh)->insert(TABLE_BUILD)->data($build)->exec(); $buildID = $this->dao->dbh($this->dbh)->lastInsertID(); diff --git a/module/release/model.php b/module/release/model.php index eb57ae9c8e..157919bc46 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -169,14 +169,16 @@ class releaseModel extends model else { $build = new stdclass(); - $build->project = $projectID; - $build->product = (int)$productID; - $build->branch = (int)$branch; - $build->name = $release->name; - $build->date = $release->date; - $build->builder = $this->app->user->account; - $build->desc = $release->desc; - $build->execution = 0; + $build->project = $projectID; + $build->product = (int)$productID; + $build->branch = (int)$branch; + $build->name = $release->name; + $build->date = $release->date; + $build->builder = $this->app->user->account; + $build->desc = $release->desc; + $build->execution = 0; + $build->createdBy = $this->app->user->account; + $build->createdDate = helper::now(); $build = $this->loadModel('file')->processImgURL($build, $this->config->release->editor->create['id']); $this->app->loadLang('build'); diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 9e13d417ca..239a413eae 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -6753,8 +6753,8 @@ class upgradeModel extends model */ public function processCreatedInfo() { - $objectTypes = array('productplan', 'release', 'testtask'); - $tables = array('productplan' => TABLE_PRODUCTPLAN, 'release' => TABLE_RELEASE, 'testtask' => TABLE_TESTTASK); + $objectTypes = array('productplan', 'release', 'testtask', 'build'); + $tables = array('productplan' => TABLE_PRODUCTPLAN, 'release' => TABLE_RELEASE, 'testtask' => TABLE_TESTTASK, 'build' => TABLE_BUILD); $actions = $this->dao->select('objectType, objectID, actor, date')->from(TABLE_ACTION)->where('objectType')->in($objectTypes)->andWhere('action')->eq('opened')->fetchGroup('objectType'); foreach($actions as $objectType => $objectActions)