diff --git a/module/upgrade/model.php b/module/upgrade/model.php index c0feb5c459..f558968679 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -596,6 +596,11 @@ class upgradeModel extends model $this->saveLogs('Execute 12_3_2'); $this->execSQL($this->getUpgradeFile('12.3.2')); $this->appendExec('12_3_2'); + case '12.3.3': + $this->saveLogs('Execute 12_3_3'); + $this->execSQL($this->getUpgradeFile('12.3.3')); + $this->addPriv12_3_3(); + $this->processImport2TaskBugs();//Code for task #7552 } $this->deletePatch(); @@ -770,6 +775,7 @@ class upgradeModel extends model case '12_3': case '12_3_1': case '12_3_2': $confirmContent .= file_get_contents($this->getUpgradeFile('12.3.2')); + case '12_3_3': $confirmContent .= file_get_contents($this->getUpgradeFile('12.3.3')); } return str_replace('zt_', $this->config->db->prefix, $confirmContent); } @@ -1564,6 +1570,34 @@ class upgradeModel extends model return true; } + /** + * Add priv for version 12.3.3 + * + * @access public + * @return bool + */ + public function addPriv12_3_3() + { + $this->saveLogs('Run Method ' . __FUNCTION__); + $privTable = $this->config->db->prefix . 'grouppriv'; + + $oldPriv = $this->dao->select('*')->from($privTable) + ->where('module')->eq('todo') + ->andWhere('method')->eq('edit') + ->fetchAll(); + foreach($oldPriv as $item) + { + $this->dao->replace($privTable) + ->set('module')->eq('todo') + ->set('method')->eq('start') + ->set('`group`')->eq($item->group) + ->exec(); + $this->saveLogs($this->dao->get()); + } + + return true; + } + /** * Add priv for 8.2. * @@ -1735,6 +1769,28 @@ class upgradeModel extends model return true; } + /** + * Process bugs which import to project tasks but canceled. + * + * @access public + * @return void + */ + public function processImport2TaskBugs() + { + $this->saveLogs('Run Method ' . __FUNCTION__); + $bugs = $this->dao->select('t1.id')->from(TABLE_BUG)->alias('t1') + ->leftJoin(TABLE_TASK)->alias('t2')->on('t1.toTask = t2.id') + ->where('t1.toTask')->ne(0) + ->andWhere('t1.status')->eq('active') + ->andWhere('t2.canceledBy')->ne('') + ->fetchPairs(); + + $this->dao->update(TABLE_BUG)->set('toTask')->eq(0)->where('id')->in($bugs)->exec(); + $this->saveLogs($this->dao->get()); + + return true; + } + /** * Delete company field for the table of zt_config and zt_groupPriv. *