* code for task#1479.

This commit is contained in:
zhujinyong
2013-07-03 07:05:45 +00:00
parent 3be8ff4a9b
commit e4e04d46bc
3 changed files with 51 additions and 0 deletions

View File

@@ -68,3 +68,4 @@ $lang->upgrade->fromVersions['4_0_beta1'] = '4.0 BETA1';
$lang->upgrade->fromVersions['4_0_beta2'] = '4.0 BETA2';
$lang->upgrade->fromVersions['4_0'] = '4.0';
$lang->upgrade->fromVersions['4_0_1'] = '4.0.1';
$lang->upgrade->fromVersions['4_1'] = '4.1';

View File

@@ -68,3 +68,4 @@ $lang->upgrade->fromVersions['4_0_beta1'] = '4.0 BETA1';
$lang->upgrade->fromVersions['4_0_beta2'] = '4.0 BETA2';
$lang->upgrade->fromVersions['4_0'] = '4.0';
$lang->upgrade->fromVersions['4_0_1'] = '4.0.1';
$lang->upgrade->fromVersions['4_1'] = '4.1';

View File

@@ -85,6 +85,10 @@ class upgradeModel extends model
$this->execSQL($this->getUpgradeFile('4.0.1'));
$this->processFlow();
$this->addPriv4_0_1();
case '4_1':
$this->execSQL($this->getUpgradeFile('4.1'));
$this->addPriv4_1();
$this->processTaskFinish();
default: if(!$this->isError()) $this->setting->updateVersion($this->config->version);
}
@@ -133,6 +137,7 @@ class upgradeModel extends model
case '4_0_beta2': $confirmContent .= file_get_contents($this->getUpgradeFile('4.0.beta2'));
case '4_0': $confirmContent .= file_get_contents($this->getUpgradeFile('4.0'));
case '4_0_1': $confirmContent .= file_get_contents($this->getUpgradeFile('4.0.1'));
case '4_1': $confirmContent .= file_get_contents($this->getUpgradeFile('4.1'));
}
return str_replace('zt_', $this->config->db->prefix, $confirmContent);
}
@@ -706,6 +711,50 @@ class upgradeModel extends model
return true;
}
/**
* Add priv for version 4.1
*
* @access public
* @return bool
*/
public function addPriv4_1()
{
$oldPriv = $this->dao->select('*')->from(TABLE_GROUPPRIV)
->where('module')->eq('tree')
->andWhere('method')->eq('browse')
->fetchAll();
foreach($oldPriv as $item)
{
$this->dao->insert(TABLE_GROUPPRIV)
->set('company')->eq($item->company)
->set('module')->eq('tree')
->set('method')->eq('browseTask')
->set('`group`')->eq($item->group)
->exec();
}
return true;
}
/**
* Process finishedBy and finishedDate of task.
*
* @access public
* @return bool
*/
public function processTaskFinish()
{
$this->dao->update(TABLE_TASK)
->set('finishedBy = lastEditedBy')
->set('finishedDate = lastEditedDate')
->where('status')->in('done,closed')
->andWhere('finishedBy')->eq('')
->exec();
return true;
}
/**
* Judge any error occers.
*