From 06d27e3cdf6edf54addf0186fa5bdbac665686ef Mon Sep 17 00:00:00 2001 From: "chencongzhi520@gmail.com" Date: Sun, 5 May 2013 09:45:25 +0000 Subject: [PATCH 1/4] * add empty index.css for old version. --- www/theme/default/index.css | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 www/theme/default/index.css diff --git a/www/theme/default/index.css b/www/theme/default/index.css new file mode 100644 index 0000000000..e69de29bb2 From f6e737f81b62cba6da0646e0024aa3759a0f0216 Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Sun, 5 May 2013 10:01:46 +0000 Subject: [PATCH 2/4] * when delete items, set autoCompany to false. --- module/setting/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/setting/model.php b/module/setting/model.php index a158b7bed9..b87052119a 100644 --- a/module/setting/model.php +++ b/module/setting/model.php @@ -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); } /** From 371e89bdfbb5d308404fea36dff966c1ba5dd430 Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Sun, 5 May 2013 10:03:06 +0000 Subject: [PATCH 3/4] * rewrite the processFlow() method. --- module/upgrade/model.php | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index c2d27f199f..af85444314 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -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§ion=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); } /** From e5a3bdfa6b0e2a0509920535c5c81e7c7c3ae3dc Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Sun, 5 May 2013 10:12:32 +0000 Subject: [PATCH 4/4] * fix the comment error. --- lib/dao/dao.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dao/dao.class.php b/lib/dao/dao.class.php index 9577dc459c..f8c426ba8a 100755 --- a/lib/dao/dao.class.php +++ b/lib/dao/dao.class.php @@ -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 = ?. */