+ re tag of 4.1.

This commit is contained in:
wangchunsheng
2013-05-05 10:14:49 +00:00
4 changed files with 14 additions and 26 deletions

View File

@@ -402,7 +402,7 @@ class dao
$sql = sprintf($this->sqlobj->get(), $this->fields, $this->table);
}
/* If the method if select, update or delete, set the comapny condition. */
/* If the method is select, update or delete, set the comapny condition. */
if(isset($this->app->company) and $autoCompany and $this->table != '' and $this->table != TABLE_COMPANY and $this->method != 'insert' and $this->method != 'replace')
{
/* Get the position to insert company = ?. */

View File

@@ -111,7 +111,7 @@ class settingModel extends model
*/
public function deleteItems($paramString)
{
$this->createDAO($this->parseItemParam($paramString), 'delete')->exec();
$this->createDAO($this->parseItemParam($paramString), 'delete')->exec($autoCompany = false);
}
/**

View File

@@ -622,31 +622,19 @@ class upgradeModel extends model
*/
public function processFlow()
{
$flows = $this->dao->select('*')->from(TABLE_CONFIG)->where('`owner`')->eq('system')->andWhere('`module`')->eq('common')->andWhere('`key`')->eq('flow')->fetchAll('company', false);
if($flows)
{
/* Set company to 0 and section to global. */
if(!isset($flows[0]))
{
$flow = array_shift($flows);
$this->dao->update(TABLE_CONFIG)->set('company')->eq(0)->set('section')->eq('global')->where('id')->eq($flow->id)->exec(false);
}
else
{
$this->dao->update(TABLE_CONFIG)->set('section')->eq('global')->where('id')->eq($flows[0]->id)->exec(false);
}
/* First delete all flow records. */
$this->setting->deleteItems('company=0,1&owner=system&module=common&section=global&key=flow');
/* Delete other flow data. */
foreach($flows as $company => $flow)
{
if($company != 0) $this->dao->delete()->from(TABLE_CONFIG)->where('id')->eq($flow->id)->exec(false);
}
}
else
{
/* Add flow to zentao.*/
$this->loadModel('setting')->setItem('system.common.global.flow', 'full', 0);
}
/* Search the extension table to check zentaotest, zentaotask, zentaostory exists or not. */
$flow = 'full';
$extension = $this->dao->select('code')->from(TABLE_EXTENSION)
->where('code')->in('zentaotest,zentaotask,zentaostory')
->andWhere('status')->eq('installed')
->fetch('code');
if($extension) $flow = 'only' . ucfirst(str_replace('zentao', '', $extension));
/* Update database again. */
$this->setting->setItem('system.common.global.flow', $flow, 0);
}
/**

View File