Merge branch 'zentaopms_9.8' of https://github.com/easysoft/zentaopms into zentaopms_9.8
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
||||
ALTER TABLE `zt_team` DROP PRIMARY KEY;
|
||||
ALTER TABLE `zt_team` ADD PRIMARY KEY (`root`, `type`, `account`);
|
||||
ALTER TABLE `zt_team` ADD `id` mediumint(8) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT FIRST;
|
||||
ALTER TABLE `zt_project` CHANGE `team` `team` varchar(90) NOT NULL;
|
||||
|
||||
+3
-1
@@ -644,6 +644,7 @@ CREATE TABLE IF NOT EXISTS `zt_taskestimate` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
-- DROP TABLE IF EXISTS `zt_team`;
|
||||
CREATE TABLE IF NOT EXISTS `zt_team` (
|
||||
`id` mediumint(8) unsigned NOT NULL auto_increment,
|
||||
`root` mediumint(8) unsigned NOT NULL default '0',
|
||||
`type` enum('project','task') NOT NULL DEFAULT 'project',
|
||||
`account` char(30) NOT NULL default '',
|
||||
@@ -656,7 +657,8 @@ CREATE TABLE IF NOT EXISTS `zt_team` (
|
||||
`consumed` DECIMAL(12,2) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`left` DECIMAL(12,2) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`order` TINYINT(3) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`root`,`type`,`account`)
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `team` (`root`,`type`,`account`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
-- DROP TABLE IF EXISTS `zt_testreport`;
|
||||
CREATE TABLE IF NOT EXISTS `zt_testreport` (
|
||||
|
||||
@@ -108,7 +108,7 @@ $lang->task->parent = '父任务';
|
||||
$lang->task->parentAB = '父';
|
||||
$lang->task->lblPri = 'P';
|
||||
$lang->task->lblHour = '(h)';
|
||||
$lang->task->deniedNotice = '当前任务只有%s才可以%s';
|
||||
$lang->task->deniedNotice = '当前任务只有%s才可以%s。';
|
||||
|
||||
$lang->task->ditto = '同上';
|
||||
$lang->task->dittoNotice = "该任务与上一任务不属于同一项目!";
|
||||
|
||||
@@ -214,6 +214,7 @@ class upgradeModel extends model
|
||||
$this->resetProductLine();
|
||||
case '9_8_2':
|
||||
$this->execSQL($this->getUpgradeFile('9.8.2'));
|
||||
$this->addUniqueKeyToTeam();
|
||||
}
|
||||
|
||||
$this->deletePatch();
|
||||
@@ -2244,4 +2245,33 @@ class upgradeModel extends model
|
||||
$this->dao->update(TABLE_PRODUCT)->set('line')->eq(0)->where('line')->in($deletedLines)->exec();
|
||||
return !dao::isError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add unique key to team table.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function addUniqueKeyToTeam()
|
||||
{
|
||||
$members = $this->dao->select('root, type, account')->from(TABLE_TEAM)->groupBy('root, type, account')->having('count(*)')->gt(1)->fetchAll();
|
||||
|
||||
foreach($members as $member)
|
||||
{
|
||||
$maxID = $this->dao->select('MAX(id) id')
|
||||
->from(TABLE_TEAM)
|
||||
->where('root')->eq($member->root)
|
||||
->andWhere('`type`')->eq($member->type)
|
||||
->andWhere('account')->eq($member->account)
|
||||
->fetch('id');
|
||||
$this->dao->delete()->from(TABLE_TEAM)
|
||||
->where('root')->eq($member->root)
|
||||
->andWhere('`type`')->eq($member->type)
|
||||
->andWhere('account')->eq($member->account)
|
||||
->andWhere('id')->ne($maxID)
|
||||
->exec();
|
||||
}
|
||||
$this->dao->exec("ALTER TABLE `zt_team` ADD UNIQUE `team` (`root`, `type`, `account`)");
|
||||
return !dao::isError();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user