Merge branch dev/bug-63656 of zentao/zentaopms (#9939)

This commit is contained in:
刘刚
2025-06-26 10:44:36 +08:00
committed by Gitfox
3 changed files with 28 additions and 18 deletions
+14 -4
View File
@@ -80,10 +80,8 @@ class actionModel extends model
$this->dao->insert(TABLE_ACTION)->data($action)->autoCheck()->exec();
$actionID = $this->dao->lastInsertID();
$productIdList = array_filter(explode(',', $action->product));
foreach($productIdList as $productID) $this->dao->insert(TABLE_ACTIONPRODUCT)->set('action')->eq($actionID)->set('product')->eq($productID)->exec();
$hasRecentTable = true;
$hasProductTable = true;
$hasRecentTable = true;
if($this->app->upgrading)
{
$fromVersion = $this->loadModel('setting')->getItem('owner=system&module=common&section=global&key=version');
@@ -92,6 +90,18 @@ class actionModel extends model
if(strpos($fromVersion, 'biz') !== false && version_compare($fromVersion, 'biz8.6', '<')) $hasRecentTable = false;
if(strpos($fromVersion, 'max') !== false && version_compare($fromVersion, 'max4.6', '<')) $hasRecentTable = false;
if(strpos($fromVersion, 'ipd') !== false && version_compare($fromVersion, 'ipd1.0.1', '<')) $hasRecentTable = false;
if(is_numeric($fromVersion[0]) && version_compare($fromVersion, '21.7.1', '<=')) $hasProductTable = false;
if(strpos($fromVersion, 'pro') !== false) $hasProductTable = false;
if(strpos($fromVersion, 'biz') !== false && version_compare($fromVersion, 'biz12.0', '<=')) $hasProductTable = false;
if(strpos($fromVersion, 'max') !== false && version_compare($fromVersion, 'max7.0', '<=')) $hasProductTable = false;
if(strpos($fromVersion, 'ipd') !== false && version_compare($fromVersion, 'ipd4.0', '<=')) $hasProductTable = false;
}
if($hasProductTable)
{
$productIdList = array_filter(explode(',', $action->product));
foreach($productIdList as $productID) $this->dao->insert(TABLE_ACTIONPRODUCT)->set('action')->eq($actionID)->set('product')->eq($productID)->exec();
}
if($actionType == 'commented')
@@ -28,14 +28,7 @@ class actionTest
global $tester, $config;
if($tester->app->upgrading && !empty($version))
{
global $tester;
$data = new stdclass();
$data->value = $version;
$data->key = 'version';
$data->owner = 'system';
$data->module = 'common';
$data->section = 'global';
$tester->dao->replace(TABLE_CONFIG)->data($data)->exec();
$tester->dao->update(TABLE_CONFIG)->set('value')->eq($version)->where('`key`')->eq('version')->andWhere('owner')->eq('system')->andWhere('module')->eq('common')->andWhere('section')->eq('global')->exec();
}
$_SERVER['HTTP_HOST'] = 'pms.zentao.com';
+13 -6
View File
@@ -3,8 +3,9 @@
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/action.unittest.class.php';
zenData('actionrecent')->gen(0);
zenData('action')->gen(0);
zenData('actionrecent')->gen(0);
zenData('actionproduct')->gen(0);
zenData('file')->gen(0);
zenData('task')->gen(1);
zenData('story')->gen(1);
@@ -54,8 +55,10 @@ cid=1
- 属性objectID @1
- 属性actor @系统
- 属性action @synctwins
- 测试升级中的并且版本号小于18.7的情况,不创建actionrecent @8
- 测试升级中的并且版本号小于18.7的情况,不创建actionrecent @7
- 测试升级中的并且版本号小于21.7.2的情况,不创建actionproduct @7
- 测试升级中的并且版本号大于18.7的情况,创建actionrecent @8
- 测试升级中的并且版本号小于21.7.2的情况,创建actionproduct @8
*/
$objectTypeList = array('task', 'project', 'user', 'bug', 'story');
@@ -66,7 +69,7 @@ $actor = 'guest';
$comment = array('', '测试备注', '<p><img src="ccreate?m=file&f=read&t=jpeg&fileID=1"></p>');
$uid = array('', uniqid());
$autoDelete = array(true, false);
$versionList = array('18.1', '18.7');
$versionList = array('18.1', '18.7', '21.7.2');
$action = new actionTest();
@@ -86,13 +89,17 @@ r($action->createTest($objectTypeList[4], $objectIDList[0], $storyActionTypeList
global $tester;
$tester->app->upgrading = true;
$version = $tester->dao->select('value')->from(TABLE_CONFIG)->where('`key`')->eq('version')->andWhere('owner')->eq('system')->andWhere('module')->eq('common')->fetch('value');
$version = $tester->dao->select('value')->from(TABLE_CONFIG)->where('`key`')->eq('version')->andWhere('owner')->eq('system')->andWhere('module')->eq('common')->andWhere('section')->eq('global')->fetch('value');
$action->createTest($objectTypeList[0], $objectIDList[0], $storyActionTypeList[0], $comment[0], '', '', '', $versionList[0]);
r($tester->dao->select('COUNT(1) AS count')->from('zt_actionrecent')->fetch('count')) && p() && e('8'); //测试升级中的并且版本号小于18.7的情况,不创建actionrecent
r($tester->dao->select('COUNT(1) AS count')->from('zt_actionrecent')->fetch('count')) && p() && e('7'); //测试升级中的并且版本号小于18.7的情况,不创建actionrecent
r($tester->dao->select('COUNT(1) AS count')->from('zt_actionproduct')->fetch('count')) && p() && e('7'); //测试升级中的并且版本号小于21.7.2的情况,不创建actionproduct
$action->createTest($objectTypeList[0], $objectIDList[0], $storyActionTypeList[0], $comment[0], '', '', '', $versionList[1]);
r($tester->dao->select('COUNT(1) AS count')->from('zt_actionrecent')->fetch('count')) && p() && e('8'); //测试升级中的并且版本号大于18.7的情况,创建actionrecent
$tester->dao->update(TABLE_CONFIG)->set('value')->eq($version)->where('`key`')->eq('version')->andWhere('owner')->eq('system')->andWhere('module')->eq('common')->exec();
$action->createTest($objectTypeList[0], $objectIDList[0], $storyActionTypeList[0], $comment[0], '', '', '', $versionList[2]);
r($tester->dao->select('COUNT(1) AS count')->from('zt_actionproduct')->fetch('count')) && p() && e('8'); //测试升级中的并且版本号小于21.7.2的情况,创建actionproduct
$tester->dao->update(TABLE_CONFIG)->set('value')->eq($version)->where('`key`')->eq('version')->andWhere('owner')->eq('system')->andWhere('module')->eq('common')->andWhere('section')->eq('global')->exec();
$tester->app->upgrading = false;