* Finish task #62919,#62923,#62924.

This commit is contained in:
daitingting
2022-08-02 07:43:12 +00:00
parent dc14d91320
commit b834dc794f
8 changed files with 67 additions and 18 deletions
+8
View File
@@ -6,3 +6,11 @@ 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`;
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'),
('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');
+12 -10
View File
@@ -149,16 +149,18 @@ class ci extends control
->fetch();
$testtask = new stdclass();
$testtask->product = $productID;
$testtask->name = !empty($post->name) ? $post->name : sprintf($this->lang->testtask->titleOfAuto, date('Y-m-d H:i:s'));
$testtask->owner = $this->app->user->account;
$testtask->project = $lastProject->project;
$testtask->execution = $lastProject->id;
$testtask->build = 'trunk';
$testtask->auto = strtolower($testType);
$testtask->begin = date('Y-m-d');
$testtask->end = date('Y-m-d', time() + 24 * 3600);
$testtask->status = 'done';
$testtask->product = $productID;
$testtask->name = !empty($post->name) ? $post->name : sprintf($this->lang->testtask->titleOfAuto, date('Y-m-d H:i:s'));
$testtask->owner = $this->app->user->account;
$testtask->project = $lastProject->project;
$testtask->execution = $lastProject->id;
$testtask->build = 'trunk';
$testtask->auto = strtolower($testType);
$testtask->begin = date('Y-m-d');
$testtask->end = date('Y-m-d', time() + 24 * 3600);
$testtask->status = 'done';
$testtask->createdBy = $this->app->user->account;
$testtask->createdDate = helper::now();
$this->dao->insert(TABLE_TESTTASK)->data($testtask)->exec();
$taskID = $this->dao->lastInsertId();
+6 -2
View File
@@ -385,7 +385,9 @@ class redmine11ConvertModel extends redmineConvertModel
/* Insert into zentao */
foreach($productPlans as $id => $productPlan)
{
$productPlan->product = $this->map['products'][$productPlan->execution_id];
$productPlan->product = $this->map['products'][$productPlan->execution_id];
$productPlan->createdBy = $this->app->user->account;
$productPlan->createdDate = helper::now();
unset($productPlan->id);
unset($productPlan->execution_id);
$this->dao->dbh($this->dbh)->insert(TABLE_PRODUCTPLAN)->data($productPlan)->exec();
@@ -395,7 +397,9 @@ class redmine11ConvertModel extends redmineConvertModel
foreach($this->map['products'] as $productID)
{
$productPlan = $this->dao->dbh($this->dbh)->select("name as title, createdDate as begin")->from(TABLE_PRODUCT)->where('id')->eq($productID)->fetch();
$productPlan->product = $productID;
$productPlan->product = $productID;
$productPlan->createdBy = $this->app->user->account;
$productPlan->createdDate = helper::now();
$this->dao->dbh($this->dbh)->insert(TABLE_PRODUCTPLAN)->data($productPlan)->exec();
$this->map['planOfProduct'][$productID] = $this->dao->lastinsertID();
}
+8 -6
View File
@@ -989,12 +989,14 @@ class convertModel extends model
if(empty($data->RELEASEDATE)) continue;
$release = new stdclass();
$release->product = $build->product;
$release->build = $buildID;
$release->name = $build->name;
$release->date = $build->date;
$release->desc = $data->DESCRIPTION;
$release->status = 'normal';
$release->product = $build->product;
$release->build = $buildID;
$release->name = $build->name;
$release->date = $build->date;
$release->desc = $data->DESCRIPTION;
$release->status = 'normal';
$release->createdBy = $this->app->user->account;
$release->createdDate = helper::now();
$this->dao->dbh($this->dbh)->insert(TABLE_RELEASE)->data($release)->exec();
$releaseID = $this->dao->dbh($this->dbh)->lastInsertID();
+2
View File
@@ -443,6 +443,8 @@ class productplanModel extends model
$plan = fixer::input('post')->stripTags($this->config->productplan->editor->create['id'], $this->config->allowedTags)
->setIF($this->post->future || empty($_POST['begin']), 'begin', $this->config->productplan->future)
->setIF($this->post->future || empty($_POST['end']), 'end', $this->config->productplan->future)
->setDefault('createdBy', $this->app->user->account)
->setDefault('createdDate', helper::now())
->remove('delta,uid,future')
->get();
+2
View File
@@ -143,6 +143,8 @@ class releaseModel extends model
->setIF($projectID, 'project', $projectID)
->setIF($this->post->build == false, 'build', 0)
->setDefault('stories', '')
->setDefault('createdBy', $this->app->user->account)
->setDefault('createdDate', helper::now())
->join('stories', ',')
->join('bugs', ',')
->join('mailto', ',')
+2
View File
@@ -31,6 +31,8 @@ class testtaskModel extends model
$task = fixer::input('post')
->setDefault('build', '')
->setIF($this->config->systemMode == 'new', 'project', $projectID)
->setDefault('createdBy', $this->app->user->account)
->setDefault('createdDate', helper::now())
->stripTags($this->config->testtask->editor->create['id'], $this->config->allowedTags)
->join('mailto', ',')
->join('type', ',')
+27
View File
@@ -530,6 +530,8 @@ class upgradeModel extends model
break;
case '17_3':
$this->processBugLinkBug();
case '17_4':
$this->processCreatedInfo();
}
$this->deletePatch();
@@ -980,6 +982,8 @@ class upgradeModel extends model
$confirmContent .= file_get_contents($this->getUpgradeFile('17.3'));
$xuanxuanSql = $this->app->getAppRoot() . 'db' . DS . 'upgradexuanxuan6.0.1.sql';
$confirmContent .= file_get_contents($xuanxuanSql);
case '17_4':
$confirmContent .= file_get_contents($this->getUpgradeFile('17.4'));
}
return $confirmContent;
@@ -6735,4 +6739,27 @@ class upgradeModel extends model
return !dao::isError();
}
/**
* Process created information.
*
* @access public
* @return void
*/
public function processCreatedInfo()
{
$objectTypes = array('productplan', 'release', 'testtask');
$tables = array('productplan' => TABLE_PRODUCTPLAN, 'release' => TABLE_RELEASE, 'testtask' => TABLE_TESTTASK);
$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)
{
foreach($objectActions as $action)
{
$this->dao->update($tables[$objectType])->set('createdBy')->eq($action->actor)->set('createdDate')->eq($action->date)->where('id')->eq($action->objectID)->exec();
}
}
return !dao::isError();
}
}