diff --git a/db/update18.3.sql b/db/update18.3.sql index 67e915554a..0dcad3eabd 100644 --- a/db/update18.3.sql +++ b/db/update18.3.sql @@ -384,6 +384,12 @@ INNER JOIN zt_project AS t2 ON t1.`project` = t2.`id` SET t1.`addedDate` = t2.`openedDate`, t1.`addedBy` = t2.`openedBy` WHERE t1.`type` = 'project' AND t1.`main` = '1'; +/* Update the execution document. */ +UPDATE zt_doc AS t1 +LEFT JOIN zt_project t2 ON t1.`execution` = t2.`id` +SET t1.`project` = t2.`project` +WHERE t1.`execution` != '0' AND t1.`project` = '0' AND t2.`project` != '0'; + /* Update the execution master library. */ UPDATE zt_doclib AS t1 INNER JOIN zt_project AS t2 ON t1.`execution` = t2.`id` diff --git a/framework/control.class.php b/framework/control.class.php index 82549c6859..2dfca05829 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -35,7 +35,7 @@ class control extends baseControl $this->app->setOpenApp(); - if(!isset($this->config->bizVersion)) return false; + if($this->config->edition == 'open') return false; /* Code for task #9224. Set requiredFields for workflow. */ if($this->dbh and (defined('IN_USE') or (defined('RUN_MODE') and RUN_MODE == 'api'))) @@ -424,7 +424,7 @@ class control extends baseControl */ public function buildOperateMenu($object, $type = 'view') { - if(!isset($this->config->bizVersion)) return false; + if($this->config->edition == 'open') return false; $moduleName = $this->moduleName; return $this->$moduleName->buildOperateMenu($object, $type); @@ -439,7 +439,7 @@ class control extends baseControl */ public function executeHooks($objectID) { - if(!isset($this->config->bizVersion)) return false; + if($this->config->edition == 'open') return false; $moduleName = $this->moduleName; return $this->$moduleName->executeHooks($objectID); @@ -454,7 +454,7 @@ class control extends baseControl */ public function getFlowExportFields() { - if(!isset($this->config->bizVersion)) return array(); + if($this->config->edition == 'open') return array(); $moduleName = $this->moduleName; return $this->$moduleName->getFlowExportFields(); @@ -478,7 +478,7 @@ class control extends baseControl */ public function printExtendFields($object, $type, $extras = '', $print = true, $moduleName = '', $methodName = '') { - if(!isset($this->config->bizVersion)) return false; + if($this->config->edition == 'open') return false; $moduleName = $moduleName ? $moduleName : $this->app->getModuleName(); $methodName = $methodName ? $methodName : $this->app->getMethodName(); diff --git a/framework/model.class.php b/framework/model.class.php index 2287fb1103..b94ced3241 100644 --- a/framework/model.class.php +++ b/framework/model.class.php @@ -99,7 +99,7 @@ class model extends baseModel if(empty($method)) $method = $methodName; static $actions = array(); - if(isset($this->config->bizVersion)) + if($this->config->edition != 'open') { if(empty($actions[$moduleName])) { @@ -155,7 +155,7 @@ class model extends baseModel */ public function buildFlowMenu($module, $data, $type = 'browse', $show = '') { - if(!isset($this->config->bizVersion)) return ''; + if($this->config->edition == 'open') return ''; $moduleName = $module; if(strpos($module, '.') !== false) list($appName, $moduleName) = explode('.', $module); @@ -233,7 +233,7 @@ class model extends baseModel */ public function processStatus($module, $record) { - if(!isset($this->config->bizVersion) or empty($record->subStatus)) return zget($this->lang->$module->statusList, $record->status); + if($this->config->edition == 'open' or empty($record->subStatus)) return zget($this->lang->$module->statusList, $record->status); return $this->loadModel('workflowfield')->processSubStatus($module, $record); } @@ -247,7 +247,7 @@ class model extends baseModel */ public function processExportData($data) { - if(!isset($this->config->bizVersion)) return $data; + if($this->config->edition == 'open') return $data; return $this->loadModel('workflowfield')->processExportData($data); } @@ -261,7 +261,7 @@ class model extends baseModel */ public function processExportOptions($data) { - if(!isset($this->config->bizVersion)) return $data; + if($this->config->edition == 'open') return $data; return $this->loadModel('workflowfield')->processExportOptions($data); } @@ -275,7 +275,7 @@ class model extends baseModel */ public function processImportData($data) { - if(!isset($this->config->bizVersion)) return $data; + if($this->config->edition == 'open') return $data; return $this->loadModel('workflowfield')->processImportData($data); } @@ -288,7 +288,7 @@ class model extends baseModel */ public function getFlowExtendFields() { - if(!isset($this->config->bizVersion)) return array(); + if($this->config->edition == 'open') return array(); return $this->loadModel('flow')->getExtendFields($this->app->getModuleName(), $this->app->getMethodName()); } @@ -301,7 +301,7 @@ class model extends baseModel */ public function getFlowExportFields() { - if(!isset($this->config->bizVersion)) return array(); + if($this->config->edition == 'open') return array(); return $this->loadModel('workflowfield')->getExportFields($this->app->getModuleName()); } @@ -315,7 +315,7 @@ class model extends baseModel */ public function executeHooks($objectID) { - if(!isset($this->config->bizVersion)) return false; + if($this->config->edition == 'open') return false; $moduleName = $this->app->getModuleName(); $methodName = $this->app->getMethodName(); diff --git a/framework/router.class.php b/framework/router.class.php index ac909cfb8b..41f2eaa016 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -478,7 +478,7 @@ class router extends baseRouter if(empty($this->rawMethod)) $this->rawMethod = $this->methodName; /* If is not a biz version or is in install mode or in in upgrade mode, call parent method. */ - if(!isset($this->config->bizVersion) or defined('IN_INSTALL') or defined('IN_UPGRADE')) return parent::setControlFile($exitIfNone); + if($this->config->edition == 'open' or defined('IN_INSTALL') or defined('IN_UPGRADE')) return parent::setControlFile($exitIfNone); /* Check if the requested module is defined in workflow. */ $flow = $this->dbh->query("SELECT * FROM " . TABLE_WORKFLOW . " WHERE `module` = '$this->moduleName'")->fetch(); diff --git a/module/action/model.php b/module/action/model.php index b2d40af67a..d54f772a6f 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -1136,9 +1136,7 @@ class actionModel extends model ->beginIF($account != 'all')->andWhere('actor')->eq($account)->fi() ->beginIF($beginDate)->andWhere('date')->ge($beginDate)->fi() ->beginIF(is_numeric($productID))->andWhere('product')->like("%,$productID,%")->fi() - ->andWhere() - ->markLeft(1) - ->where('1=1') + ->andWhere('1=1', true) ->beginIF(is_numeric($projectID))->andWhere('project')->eq($projectID)->fi() ->beginIF(!empty($executions))->andWhere('execution')->in(array_keys($executions))->fi() ->beginIF(is_numeric($executionID))->andWhere('execution')->eq($executionID)->fi() diff --git a/module/admin/control.php b/module/admin/control.php index be3f68d288..be05d520ba 100755 --- a/module/admin/control.php +++ b/module/admin/control.php @@ -478,7 +478,7 @@ class admin extends control $response['thisTable'] = ''; $response['nextTable'] = ''; - $tableEngines = $this->loadModel('misc')->getTableEngines(); + $tableEngines = $this->dao->getTableEngines(); $thisTable = ''; $nextTable = ''; diff --git a/module/api/control.php b/module/api/control.php index 3563dfd41a..b338cac69b 100755 --- a/module/api/control.php +++ b/module/api/control.php @@ -52,6 +52,15 @@ class api extends control $objectType = $this->objectType; $objectID = $this->objectID; $isFirstLoad = $libID ? false : true; + if($libID) + { + $lib = $this->doc->getLibById($libID); + if($objectType == 'nolink' and !$objectID and ($lib->product or $lib->project)) + { + $objectType = $lib->product ? 'product' : 'project'; + $objectID = $lib->product ? $lib->product : $lib->project; + } + } if($release) { @@ -158,7 +167,7 @@ class api extends control if(!strpos($this->server->http_referer, 'space') and !strpos($this->server->http_referer, 'api')) setCookie("docSpaceParam", '', $this->config->cookieLife, $this->config->webRoot, '', false, true); /* Get all api doc libraries. */ - $libs = $this->doc->getApiLibs($libID); + $libs = $this->doc->getApiLibs($libID, $this->objectType, $this->objectID); $api = $this->api->getLibById($apiID, $version, $release); if($api) { @@ -174,7 +183,7 @@ class api extends control } /* Crumbs links array. */ - $lib = zget($libs, $libID); + $lib = zget($libs, $libID); $type = $lib->product ? 'product' : ($lib->project ? 'project' : 'unlink'); $methodName = $type != 'unlink' ? $type . 'Space' : 'index'; @@ -768,7 +777,7 @@ class api extends control if(in_array($this->session->spaceType, array('product', 'project'))) { - $this->lang->doc->menu->api['exclude'] = 'api-' . $this->app->rawMethod; + $this->lang->doc->menu->api['exclude'] = 'api-' . $this->app->rawMethod . ',' . $this->app->rawMethod; $this->lang->doc->menu->{$this->session->spaceType}['subModule'] = 'api'; } else diff --git a/module/api/view/apilist.html.php b/module/api/view/apilist.html.php index 897a1c6da9..75e50d6ebf 100644 --- a/module/api/view/apilist.html.php +++ b/module/api/view/apilist.html.php @@ -115,7 +115,7 @@
  • - lib}&moduleID=0&apiID={$api->id}&version=0&release=$release");?>" data-app="tab;?>"> + lib}&moduleID=0&apiID={$api->id}&version=0");?>" data-app="tab;?>"> method;?> path;?> title;?> diff --git a/module/chart/lang/de.php b/module/chart/lang/de.php index dfbb0c6642..65b1d63669 100644 --- a/module/chart/lang/de.php +++ b/module/chart/lang/de.php @@ -36,7 +36,7 @@ $lang->chart->typeList = array(); $lang->chart->typeList['pie'] = 'Pie'; $lang->chart->typeList['line'] = 'Line'; $lang->chart->typeList['radar'] = 'Radar'; -$lang->chart->typeList['cluBarY'] = 'clustered Bar Y'; -$lang->chart->typeList['stackedBarY'] = 'stacked Bar Y'; -$lang->chart->typeList['cluBarX'] = 'clustered Bar X'; -$lang->chart->typeList['stackedBar'] = 'stacked Bar'; +$lang->chart->typeList['cluBarY'] = 'Clustered Bar Y'; +$lang->chart->typeList['stackedBarY'] = 'Stacked Bar Y'; +$lang->chart->typeList['cluBarX'] = 'Clustered Bar X'; +$lang->chart->typeList['stackedBar'] = 'Stacked Bar'; diff --git a/module/chart/lang/en.php b/module/chart/lang/en.php index dfbb0c6642..65b1d63669 100644 --- a/module/chart/lang/en.php +++ b/module/chart/lang/en.php @@ -36,7 +36,7 @@ $lang->chart->typeList = array(); $lang->chart->typeList['pie'] = 'Pie'; $lang->chart->typeList['line'] = 'Line'; $lang->chart->typeList['radar'] = 'Radar'; -$lang->chart->typeList['cluBarY'] = 'clustered Bar Y'; -$lang->chart->typeList['stackedBarY'] = 'stacked Bar Y'; -$lang->chart->typeList['cluBarX'] = 'clustered Bar X'; -$lang->chart->typeList['stackedBar'] = 'stacked Bar'; +$lang->chart->typeList['cluBarY'] = 'Clustered Bar Y'; +$lang->chart->typeList['stackedBarY'] = 'Stacked Bar Y'; +$lang->chart->typeList['cluBarX'] = 'Clustered Bar X'; +$lang->chart->typeList['stackedBar'] = 'Stacked Bar'; diff --git a/module/chart/lang/fr.php b/module/chart/lang/fr.php index dfbb0c6642..65b1d63669 100644 --- a/module/chart/lang/fr.php +++ b/module/chart/lang/fr.php @@ -36,7 +36,7 @@ $lang->chart->typeList = array(); $lang->chart->typeList['pie'] = 'Pie'; $lang->chart->typeList['line'] = 'Line'; $lang->chart->typeList['radar'] = 'Radar'; -$lang->chart->typeList['cluBarY'] = 'clustered Bar Y'; -$lang->chart->typeList['stackedBarY'] = 'stacked Bar Y'; -$lang->chart->typeList['cluBarX'] = 'clustered Bar X'; -$lang->chart->typeList['stackedBar'] = 'stacked Bar'; +$lang->chart->typeList['cluBarY'] = 'Clustered Bar Y'; +$lang->chart->typeList['stackedBarY'] = 'Stacked Bar Y'; +$lang->chart->typeList['cluBarX'] = 'Clustered Bar X'; +$lang->chart->typeList['stackedBar'] = 'Stacked Bar'; diff --git a/module/chart/model.php b/module/chart/model.php index 9192c34b29..5dd1919c42 100644 --- a/module/chart/model.php +++ b/module/chart/model.php @@ -72,7 +72,7 @@ class chartModel extends model if(!empty($chart->sql)) $chart->sql = trim(str_replace(';', '', $chart->sql)); if(!empty($chart->settings)) $chart->settings = json_decode($chart->settings, true); - if(!empty($chart->settings) and is_array($chart->settings)) + if(empty($chart->type) and !empty($chart->settings) and is_array($chart->settings)) { $firstSetting = current($chart->settings); if(isset($firstSetting['type'])) $chart->type = $firstSetting['type']; @@ -696,5 +696,110 @@ class chartModel extends model return $filterFormat; } + + /** + * Get tables. + * + * @param string $sql + * @access public + * @return array + */ + public function getTables($sql) + { + $processedSql = trim($sql, ';'); + $processedSql = str_replace(array("\r\n", "\n"), ' ', $processedSql); + $processedSql = str_replace('`', '', $processedSql); + preg_match_all('/^select (.+) from (.+)$/i', $processedSql, $selectAndFrom); + if(empty($selectAndFrom[2][0])) return false; + + $selectSql = $selectAndFrom[1][0]; + $tableSql = $fromSql = $selectAndFrom[2][0]; + if(stripos($fromSql, 'where') !== false) $tableSql = trim(substr($fromSql, 0, stripos($fromSql, 'where'))); + if(stripos($fromSql, 'limit') !== false) $tableSql = trim(substr($fromSql, 0, stripos($fromSql, 'limit'))); + if(stripos($fromSql, 'having') !== false) $tableSql = trim(substr($fromSql, 0, stripos($fromSql, 'having'))); + if(stripos($fromSql, 'group by') !== false) $tableSql = trim(substr($fromSql, 0, stripos($fromSql, 'group by'))); + + /* Remove such as "left join|right join|join", "on (t1.id=t2.id)", result like t1, t2 as t3. */ + $tableSql .= ' '; + if(stripos($tableSql, 'join') !== false) $tableSql = preg_replace(array('/join\s+([A-Z]+_\w+ .*)on/Ui', '/,\s*on\s+[^,]+/i'), array(',$1,on', ''), $tableSql); + + /* Match t2 as t3 */ + preg_match_all('/(\w+) +as +(\w+)/i', $tableSql, $out); + + $fields = explode(',', $selectSql); + foreach($fields as $i => $field) + { + if($field) $asField = ''; + if(strrpos($field, ' as ') !== false) list($field, $asField) = explode(' as ', $field); + if(strrpos($field, ' AS ') !== false) list($field, $asField) = explode(' AS ', $field); + + $field = trim($field); + $asField = trim($asField); + $fieldName = $field; + if(strrpos($field, '.') !== false) + { + $table = substr($field, 0, strrpos($field, '.')); + $fieldName = substr($field, strrpos($field, '.') + 1); + if(!empty($out[0]) and in_array($table, $out[2])) + { + $realTable = $out[1][array_search($table, $out[2])]; + $tableFieldName = str_replace($table . '.', $realTable . '.', $field); + + if(isset($fields[$fieldName]) && !$asField) + { + $fieldName = str_replace('.', '', $field); + + $sql = preg_replace(array("/$field/", "/`$field`/"), array("$field AS $fieldName", "`$field` AS $fieldName"), $sql, 1); + + $field = $tableFieldName; + } + } + + if($fieldName == '*') $fieldName = $field; + } + + $fieldName = $asField ? $asField : $fieldName; + + $fields[$fieldName] = $field; + unset($fields[$i]); + } + + $tableSql = preg_replace('/as +\w+/i', ' ', $tableSql); + $tableSql = trim(str_replace(array('(', ')', ','), ' ', $tableSql)); + $tableSql = preg_replace('/ +/', ' ', $tableSql); + + $tables = explode(' ', $tableSql); + + return array('sql' => $sql, 'tables' => $tables, 'fields' => $fields); + } + + /** + * Parse variables to null string in sql. + * + * @param string $sql + * @access public + * @return string + */ + public function parseSqlVars($sql, $filters) + { + if($filters) + { + foreach($filters as $filter) + { + if(!isset($filter['default'])) continue; + if(isset($filter['from']) and $filter['from'] == 'query') + { + $default = "'{$filter['default']}'"; + $sql = str_replace('$' . $filter['field'], $default, $sql); + } + } + } + if(preg_match_all("/[\$]+[a-zA-Z0-9]+/", $sql, $out)) + { + foreach($out[0] as $match) $sql = str_replace($match, "''", $sql); + } + + return $sql; + } } diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index d602aa4238..b84a44a518 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -256,7 +256,7 @@ $lang->waterfall->menu = new stdclass(); $lang->waterfall->menu->index = array('link' => "$lang->dashboard|project|index|project=%s"); $lang->waterfall->menu->execution = array('link' => "{$lang->stage->common}|project|execution|status=all&projectID=%s", 'subModule' => 'programplan,task'); $lang->waterfall->menu->storyGroup = array('link' => "{$lang->common->story}|projectstory|story|projectID=%s",'class' => 'dropdown dropdown-hover', 'exclude' => 'tree-browse,projectstory-track'); -$lang->waterfall->menu->story = array('link' => "$lang->SRCommon|projectstory|story|projectID=%s", 'subModule' => 'projectstory,tree', 'alias' => 'story', 'exclude' => 'projectstory-track'); +$lang->waterfall->menu->story = array('link' => "$lang->SRCommon|projectstory|story|projectID=%s", 'subModule' => 'projectstory,tree', 'alias' => 'story', 'exclude' => 'projectstory-track,tree-browse'); $lang->waterfall->menu->design = array('link' => "{$lang->design->common}|design|browse|project=%s"); $lang->waterfall->menu->qa = array('link' => "{$lang->qa->common}|project|bug|projectID=%s", 'subModule' => 'testcase,testtask,bug,testreport', 'alias' => 'bug,testtask,testcase,testreport'); $lang->waterfall->menu->doc = array('link' => "{$lang->doc->common}|doc|projectSpace|objectID=%s"); @@ -264,18 +264,9 @@ $lang->waterfall->menu->devops = array('link' => "{$lang->repo->common}|repo $lang->waterfall->menu->build = array('link' => "{$lang->build->common}|projectbuild|browse|project=%s", 'subModule' => 'projectbuild'); $lang->waterfall->menu->release = array('link' => "{$lang->release->common}|projectrelease|browse|project=%s", 'subModule' => 'projectrelease'); $lang->waterfall->menu->dynamic = array('link' => "$lang->dynamic|project|dynamic|project=%s"); -$lang->waterfall->menu->settings = array('link' => "$lang->settings|project|view|project=%s", 'subModule' => 'stakeholder', 'alias' => 'edit,manageproducts,group,managemembers,manageview,managepriv,whitelist,addwhitelist,team', 'exclude' => 'tree-browsetask'); -$lang->waterfall->menu->settings['subMenu'] = new stdclass(); -$lang->waterfall->menu->settings['subMenu']->view = array('link' => "$lang->overview|project|view|project=%s", 'alias' => 'edit'); -$lang->waterfall->menu->settings['subMenu']->products = array('link' => "{$lang->productCommon}|project|manageProducts|project=%s", 'alias' => 'manageproducts'); -$lang->waterfall->menu->settings['subMenu']->members = array('link' => "{$lang->team->common}|project|team|project=%s", 'alias' => 'managemembers,team'); -$lang->waterfall->menu->settings['subMenu']->whitelist = array('link' => "{$lang->whitelist}|project|whitelist|project=%s", 'subModule' => 'personnel'); -$lang->waterfall->menu->settings['subMenu']->stakeholder = array('link' => "{$lang->stakeholder->common}|stakeholder|browse|project=%s", 'subModule' => 'stakeholder'); -$lang->waterfall->menu->settings['subMenu']->group = array('link' => "{$lang->priv}|project|group|project=%s", 'alias' => 'group,manageview,managepriv'); -$lang->waterfall->menu->settings['subMenu']->module = array('link' => "{$lang->module}|tree|browse|product=%s&view=story"); - -$lang->waterfall->dividerMenu = ',programplan,build,dynamic,'; +$lang->waterfall->menu->settings = $lang->scrum->menu->settings; +$lang->waterfall->dividerMenu = ',programplan,build,dynamic,'; $lang->waterfall->menu->storyGroup['dropMenu'] = $lang->scrum->menu->storyGroup['dropMenu']; diff --git a/module/common/model.php b/module/common/model.php index 6633796d01..11b4d910e1 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -2078,6 +2078,7 @@ EOF; if(strtolower($key) == 'assigneddate') continue; if(strtolower($key) == 'editedby') continue; if(strtolower($key) == 'editeddate') continue; + if(strtolower($key) == 'editingdate') continue; if(strtolower($key) == 'uid') continue; if(strtolower($key) == 'finisheddate' and $value == '') continue; if(strtolower($key) == 'canceleddate' and $value == '') continue; diff --git a/module/convert/model.php b/module/convert/model.php index 45e48cc0ac..8eb185fec4 100644 --- a/module/convert/model.php +++ b/module/convert/model.php @@ -128,7 +128,7 @@ class convertModel extends model { $dataList = $this->dao->dbh($this->sourceDBH)->select('t1.`ID`, t1.`lower_user_name` as account, t1.`lower_display_name` as realname, t1.`lower_email_address` as email, t1.created_date as `join`, t2.user_key as userCode')->from(JIRA_USERINFO)->alias('t1') ->leftJoin(JIRA_USER)->alias('t2')->on('t1.`lower_user_name` = t2.`lower_user_name`') - ->where(1) + ->where('1=1') ->beginIF($lastID)->andWhere('t1.ID')->gt($lastID)->fi() ->orderBy('t1.ID asc')->limit($limit) ->fetchAll('ID'); @@ -136,7 +136,7 @@ class convertModel extends model elseif($module == 'project') { $dataList = $this->dao->dbh($this->sourceDBH)->select('*')->from(JIRA_PROJECT) - ->where(1) + ->where('1=1') ->beginIF($lastID)->andWhere('ID')->gt($lastID)->fi() ->orderBy('ID asc')->limit($limit) ->fetchAll('ID'); @@ -144,7 +144,7 @@ class convertModel extends model elseif($module == 'issue') { $dataList = $this->dao->dbh($this->sourceDBH)->select('*')->from(JIRA_ISSUE) - ->where(1) + ->where('1=1') ->beginIF($lastID)->andWhere('ID')->gt($lastID)->fi() ->orderBy('ID asc')->limit($limit) ->fetchAll('ID'); @@ -152,7 +152,7 @@ class convertModel extends model elseif($module == 'build') { $dataList = $this->dao->dbh($this->sourceDBH)->select('*')->from(JIRA_BUILD) - ->where(1) + ->where('1=1') ->beginIF($lastID)->andWhere('ID')->gt($lastID)->fi() ->orderBy('ID asc')->limit($limit) ->fetchAll('ID'); @@ -160,7 +160,7 @@ class convertModel extends model elseif($module == 'issuelink') { $dataList = $this->dao->dbh($this->sourceDBH)->select('*')->from(JIRA_ISSUELINK) - ->where(1) + ->where('1=1') ->beginIF($lastID)->andWhere('ID')->gt($lastID)->fi() ->orderBy('ID asc')->limit($limit) ->fetchAll('ID'); @@ -168,7 +168,7 @@ class convertModel extends model elseif($module == 'action') { $dataList = $this->dao->dbh($this->sourceDBH)->select('*')->from(JIRA_ACTION) - ->where(1) + ->where('1=1') ->beginIF($lastID)->andWhere('ID')->gt($lastID)->fi() ->orderBy('ID asc')->limit($limit) ->fetchAll('ID'); @@ -176,7 +176,7 @@ class convertModel extends model elseif($module == 'file') { $dataList = $this->dao->dbh($this->sourceDBH)->select('*')->from(JIRA_FILE) - ->where(1) + ->where('1=1') ->beginIF($lastID)->andWhere('ID')->gt($lastID)->fi() ->orderBy('ID asc')->limit($limit) ->fetchAll('ID'); diff --git a/module/doc/model.php b/module/doc/model.php index 4ed5ee207b..7a6611d5a6 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -47,13 +47,13 @@ class docModel extends model $libs = $this->dao->select('*')->from(TABLE_DOCLIB) ->where('deleted')->eq(0) ->andWhere('type')->eq('api') - ->beginIF(!empty($appendLib))->orWhere('id')->eq($appendLib)->fi() - ->beginIF(!empty($objectType) && $objectID > 0 and $objectType != 'nolink')->andWhere($objectType)->eq($objectID)->fi() + ->beginIF(!empty($objectType) and $objectID > 0 and $objectType != 'nolink')->andWhere($objectType)->eq($objectID)->fi() ->beginIF($objectType == 'nolink') ->andWhere('product')->eq(0) ->andWhere('project')->eq(0) ->andWhere('execution')->eq(0) ->fi() + ->beginIF(!empty($appendLib))->orWhere('id')->eq($appendLib)->fi() ->orderBy('order_asc, id_asc') ->fetchAll('id'); @@ -1218,7 +1218,7 @@ class docModel extends model if($libID == 0 and $browseType != 'collectedbyme') return array(); $modules = $this->dao->select('*')->from(TABLE_MODULE) - ->where(1) + ->where('1=1') ->beginIF($browseType != "collectedbyme")->andWhere('root')->eq($libID)->fi() ->beginIF($browseType == "collectedbyme")->andWhere('collector')->like("%,{$this->app->user->account},%")->fi() ->andWhere('type')->eq('doc') diff --git a/module/doc/view/editothertype.html.php b/module/doc/view/editothertype.html.php index fe120dfb06..132dfa39a6 100644 --- a/module/doc/view/editothertype.html.php +++ b/module/doc/view/editothertype.html.php @@ -30,7 +30,7 @@ - + diff --git a/module/doc/view/lefttree.html.php b/module/doc/view/lefttree.html.php index 784076aded..cd28066fcf 100644 --- a/module/doc/view/lefttree.html.php +++ b/module/doc/view/lefttree.html.php @@ -76,6 +76,8 @@ li.drag-shadow ul {display: none !important;} js::set('release', isset($release) ? $release : 0); js::set('versionLang', $lang->build->common); js::set('spaceType', $this->session->spaceType); +js::set('rawModule', $this->app->rawModule); +js::set('rawMethod', $this->app->rawMethod); /* ObjectType and objectID used for other space. */ js::set('objectType', isset($type) ? $type : ''); @@ -151,7 +153,7 @@ js::set('hasLibPriv', $hasLibPriv);
  • doc->libDropdown['addSubModule'];?>
  • -
  • rawModule");?>'>doc->libDropdown['editModule'];?>
  • +
  • rawModule == 'api' ? 'api' : 'doc'));?>'>doc->libDropdown['editModule'];?>
  • ' target='hiddenwin'>doc->libDropdown['delModule'];?>
  • @@ -473,8 +475,8 @@ $(function() if(!libID) libID = 0; if(!moduleID) moduleID = 0; linkParams = linkParams.replace('%s', 'libID=' + libID + '&moduleID=' + moduleID); - if(config.currentModule == 'api' && config.currentMethod == 'view') spaceType = 'api'; - if(spaceType != 'api' && config.currentModule == 'api') linkParams = 'objectID=' + objectID + '&' + linkParams; + if(rawModule == 'api' && rawMethod== 'view') spaceType = 'api'; + if(spaceType != 'api' && rawModule == 'api') linkParams = 'objectID=' + objectID + '&' + linkParams; var moduleName = spaceType == 'api' ? 'api' : 'doc'; var methodName = ''; if(spaceType == 'api') @@ -624,7 +626,7 @@ $(function() var libID = $(this).closest('#versionSwitcher').data('lib'); var moduleID = $(this).data('id'); var params = 'libID=' + libID + '&moduleID=0&apiID=0&version=0&release=' + moduleID; - var methodName = config.currentMethod; + var methodName = rawMethod; if(config.currentModule == 'doc') { params = linkParams.replace('%s', 'libID=' + libID + '&moduleID=0').replace('browseType=&', 'browseType=byrelease&').replace('param=0', 'param=' + moduleID); diff --git a/module/execution/model.php b/module/execution/model.php index fb92c42f96..6895d02cb3 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -5784,11 +5784,6 @@ class executionModel extends model $post = $_POST; $_POST = array(); - $extendFields = $this->getExtendFields(); - foreach(array_keys($extendFields) as $field) - { - if(isset($post[$field])) $_POST[$field] = $post[$field]; - } $_POST['project'] = $projectID; $_POST['name'] = $project->name; @@ -5843,11 +5838,6 @@ class executionModel extends model $post = $_POST; $_POST = array(); - $extendFields = $this->getExtendFields(); - foreach(array_keys($extendFields) as $field) - { - if(isset($post[$field])) $_POST[$field] = $post[$field]; - } $_POST['project'] = $projectID; $_POST['name'] = $project->name; @@ -6037,23 +6027,4 @@ class executionModel extends model } return $sortedExecutions; } - - /** - * Get Extend Fields in workflow. - * - * @param string $module - * @access public - * @return array - */ - public function getExtendFields($module = 'project') - { - $extendFields = $this->dao->select('field') - ->from(TABLE_WORKFLOWFIELD) - ->where('module')->eq('project') - ->andWhere('buildin')->eq(0) - ->andWhere('role')->eq('custom') - ->fetchPairs('field'); - - return $extendFields; - } } diff --git a/module/install/control.php b/module/install/control.php index b550680de9..3b980aaaef 100644 --- a/module/install/control.php +++ b/module/install/control.php @@ -299,9 +299,9 @@ class install extends control $canDelFile = is_writable($this->app->getAppRoot() . 'www'); $installFile = $this->app->getAppRoot() . 'www/install.php'; $upgradeFile = $this->app->getAppRoot() . 'www/upgrade.php'; - $installFileDeleted = $canDelFile && is_writable($installFile) ? unlink($installFile) : false; + $installFileDeleted = ($canDelFile and file_exists($installFile)) ? unlink($installFile) : false; - if($canDelFile and is_writable($upgradeFile)) unlink($upgradeFile); + if($canDelFile and file_exists($upgradeFile)) unlink($upgradeFile); unset($_SESSION['installing']); session_destroy(); diff --git a/module/kanban/model.php b/module/kanban/model.php index e5ae52bd69..57c4976279 100755 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -3705,7 +3705,7 @@ class kanbanModel extends model public function getColumnsByObject($objectType = '', $objectID = 0, $archived = 0, $deleted = '0') { return $this->dao->select('*')->from(TABLE_KANBANCOLUMN) - ->where(true) + ->where('1=1') ->beginIF($objectType)->andWhere($objectType)->eq($objectID)->fi() ->beginIF($archived != '')->andWhere('archived')->eq($archived)->fi() ->beginIF($deleted != '')->andWhere('deleted')->eq($deleted)->fi() @@ -3817,7 +3817,7 @@ class kanbanModel extends model public function getCardsByObject($objectType = '', $objectID = 0, $archived = '0', $deleted = '0') { return $this->dao->select('*')->from(TABLE_KANBANCARD) - ->where(true) + ->where('1=1') ->beginIF($objectType)->andWhere($objectType)->eq($objectID)->fi() ->beginIF($archived != '')->andWhere('archived')->eq($archived)->fi() ->beginIF($deleted != '')->andWhere('deleted')->eq($deleted)->fi() diff --git a/module/pivot/control.php b/module/pivot/control.php index 8a364763a5..d06bd6b986 100644 --- a/module/pivot/control.php +++ b/module/pivot/control.php @@ -71,7 +71,7 @@ class pivot extends control $pivot->sql = $sql; - $processSqlData = $this->loadModel('dataview')->getTables($sql); + $processSqlData = $this->loadModel('chart')->getTables($sql); $sql = $processSqlData['sql']; list($data, $configs) = $this->pivot->genSheet(json_decode(json_encode($pivot->fieldSettings), true), $pivot->settings, $sql, $filterFormat, json_decode($pivot->langs, true)); diff --git a/module/pivot/view/show.html.php b/module/pivot/view/show.html.php index bcf7238fdf..2d688e3073 100644 --- a/module/pivot/view/show.html.php +++ b/module/pivot/view/show.html.php @@ -46,7 +46,7 @@
    - loadModel('dataview')->parseSqlVars($pivot->sql, $pivot->filters);?> + loadModel('chart')->parseSqlVars($pivot->sql, $pivot->filters);?> pivot->buildPivotTable($data, $configs, json_decode(json_encode($pivot->fieldSettings), true), $sql);?>
    diff --git a/module/product/model.php b/module/product/model.php index b34abb85fb..aa49c1c194 100755 --- a/module/product/model.php +++ b/module/product/model.php @@ -370,7 +370,7 @@ class productModel extends model /* Order by program. */ return $this->dao->select("t1.*, IF(INSTR(' closed', t1.status) < 2, 0, 1) AS isClosed")->from(TABLE_PRODUCT)->alias('t1') ->leftJoin(TABLE_PROGRAM)->alias('t2')->on('t1.program = t2.id') - ->where(1) + ->where('1=1') ->beginIF(strpos($mode, 'all') === false)->andWhere('t1.deleted')->eq(0)->fi() ->beginIF($programID)->andWhere('t1.program')->eq($programID)->fi() ->beginIF(strpos($mode, 'noclosed') !== false)->andWhere('t1.status')->ne('closed')->fi() diff --git a/module/project/control.php b/module/project/control.php index 7d80027c0c..1ed9cfc8d4 100755 --- a/module/project/control.php +++ b/module/project/control.php @@ -904,7 +904,7 @@ class project extends control /* Check exist extend fields. */ $isExtended = false; - if(!empty($this->config->bizVersion)) + if($this->config->edition != 'open') { $extend = $this->loadModel('workflowaction')->getByModuleAndAction('project', 'view'); if(!empty($extend) and $extend->extensionType == 'extend') $isExtended = true; diff --git a/module/project/model.php b/module/project/model.php index 1c14cdb5ab..6ceeb87ee9 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -139,6 +139,8 @@ class projectModel extends model } } + setcookie('lastProject', (int)$this->session->project, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); + return $this->session->project; } diff --git a/module/search/model.php b/module/search/model.php index 4ecf897ed2..82e4b2d8fa 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -463,12 +463,10 @@ class searchModel extends model { $queries = $this->dao->select('id, title') ->from(TABLE_USERQUERY) - ->where() - ->markLeft(1) - ->where('account')->eq($this->app->user->account) + ->where('module')->eq($module) + ->andWhere('account', true)->eq($this->app->user->account) ->orWhere('common')->eq(1) ->markRight(1) - ->andWhere('module')->eq($module) ->orderBy('id_desc') ->fetchPairs(); if(!$queries) return array('' => $this->lang->search->myQuery); @@ -487,12 +485,10 @@ class searchModel extends model { $queries = $this->dao->select('id, account, title') ->from(TABLE_USERQUERY) - ->where() - ->markLeft(1) - ->where('account')->eq($this->app->user->account) + ->where('module')->eq($module) + ->andWhere('account', true)->eq($this->app->user->account) ->orWhere('common')->eq(1) ->markRight(1) - ->andWhere('module')->eq($module) ->orderBy('id_desc') ->fetchAll(); if(!$queries) return array('' => $this->lang->search->myQuery); diff --git a/module/todo/lang/de.php b/module/todo/lang/de.php index 9dff94babf..fe79406849 100644 --- a/module/todo/lang/de.php +++ b/module/todo/lang/de.php @@ -27,7 +27,7 @@ $lang->todo->finish = "Abschließen"; $lang->todo->batchFinish = "Mehrere abschließen"; $lang->todo->export = "Exportieren"; $lang->todo->delete = "Löschen"; -$lang->todo->import2Today = "Importieren für Heute"; +$lang->todo->import2Today = "Change Date"; $lang->todo->import = "Importieren"; $lang->todo->legendBasic = "Basis Info"; $lang->todo->cycle = "Wiederkehrend"; diff --git a/module/todo/lang/en.php b/module/todo/lang/en.php index 2ef3a1f8a2..f70311ef76 100644 --- a/module/todo/lang/en.php +++ b/module/todo/lang/en.php @@ -27,7 +27,7 @@ $lang->todo->finish = "Finish Todo"; $lang->todo->batchFinish = "Batch Finish"; $lang->todo->export = "Export Todo"; $lang->todo->delete = "Delete Todo"; -$lang->todo->import2Today = "Import to Today"; +$lang->todo->import2Today = "Change Date"; $lang->todo->import = "Import"; $lang->todo->legendBasic = "Basic Info"; $lang->todo->cycle = "Recur"; diff --git a/module/todo/lang/fr.php b/module/todo/lang/fr.php index f55595253e..5e85754dd2 100644 --- a/module/todo/lang/fr.php +++ b/module/todo/lang/fr.php @@ -27,7 +27,7 @@ $lang->todo->finish = "Terminer"; $lang->todo->batchFinish = "Terminer par lot"; $lang->todo->export = "Exporter Agenda"; $lang->todo->delete = "Supprimer"; -$lang->todo->import2Today = "Importer à Aujourd'hui"; +$lang->todo->import2Today = "Change Date"; $lang->todo->import = "Importer"; $lang->todo->legendBasic = "Infos de Base"; $lang->todo->cycle = "Rendre Récurrent"; diff --git a/module/todo/lang/zh-cn.php b/module/todo/lang/zh-cn.php index 5870fffa1b..0940640717 100644 --- a/module/todo/lang/zh-cn.php +++ b/module/todo/lang/zh-cn.php @@ -27,7 +27,7 @@ $lang->todo->finish = "完成待办"; $lang->todo->batchFinish = "批量完成"; $lang->todo->export = "导出待办"; $lang->todo->delete = "删除待办"; -$lang->todo->import2Today = "导入到今天"; +$lang->todo->import2Today = "修改日期"; $lang->todo->import = "导入"; $lang->todo->legendBasic = "基本信息"; $lang->todo->cycle = "周期"; diff --git a/module/upgrade/config.php b/module/upgrade/config.php index bc820d65fd..c9f0bdbdbb 100644 --- a/module/upgrade/config.php +++ b/module/upgrade/config.php @@ -502,7 +502,6 @@ $config->delete['18_4_alpha1'][] = 'extension/max/report/ext/lang/zh-tw/report.p $config->delete['18_4_alpha1'][] = 'extension/max/report/ext/view/programsummary.html.php'; $config->delete['18_4_alpha1'][] = 'extension/max/report/ext/view/programworkload.html.php'; $config->delete['18_4_alpha1'][] = 'extension/max/report/ext/view/instancetemplate.html.php'; -$config->delete['18_4_alpha1'][] = 'extension/max/report/ext/view/blockreportlist.html.php'; $config->upgrade->openModules = array('action', 'admin', 'api', 'automation', 'backup', 'block', 'branch', 'budget', 'bug', 'build', 'caselib', 'chart', 'ci', 'client', 'common', 'company', 'compile', 'convert', 'cron', 'custom', 'datatable', 'dataview', 'dept', 'design', 'dev', 'dimension', 'doc', 'durationestimation', 'entry', 'execution', 'extension', 'file', 'git', 'gitlab', 'group', 'holiday', 'im', 'index', 'index.html', 'install', 'issue', 'jenkins', 'job', 'kanban', 'license', 'mail', 'message', 'misc', 'mr', 'my', 'personnel', 'pipeline', 'product', 'productplan', 'productset', 'program', 'programplan', 'project', 'projectbuild', 'projectplan', 'projectrelease', 'projectstory', 'pivot', 'qa', 'release', 'repo', 'report', 'risk', 'score', 'screen', 'search', 'setting', 'sonarqube', 'sso', 'stage', 'stakeholder', 'story', 'subject', 'svn', 'task', 'testcase', 'testreport', 'testsuite', 'testtask', 'todo', 'tree', 'tutorial', 'upgrade', 'user', 'webhook', 'weekly', 'workestimation', 'gitea', 'gogs', 'transfer', 'zahost', 'zanode', 'editor'); diff --git a/module/upgrade/model.php b/module/upgrade/model.php index f970fceafd..8054ed6250 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -9051,7 +9051,7 @@ class upgradeModel extends model /* Process settings. */ $settings = new stdclass(); - $settings->columns = array(); + $columns = array(); if($report->params) { $params = json_decode($report->params); @@ -9060,7 +9060,6 @@ class upgradeModel extends model $settings->group2 = $params->group2; $settings->columnTotal = 'sum'; - $columns = array(); foreach($params->reportField as $index => $field) { $column = new stdclass(); @@ -9081,14 +9080,24 @@ class upgradeModel extends model $columns[] = $column; } - $settings->columns = $columns; } else { + $column = new stdclass(); + $column->field = ''; + $column->stat = ''; + $column->slice = 'noSlice'; + $column->showMode = 'default'; + $column->showTotal = 'noShow'; + + $columns[] = $column; + $data->stage = 'draft'; $data->step = 1; } + $settings->columns = $columns; + /* Process fieldSettings. */ $sql = $data->sql; if(!empty($filters)) diff --git a/module/user/model.php b/module/user/model.php index 1c80f50a72..8c08c0b141 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -41,7 +41,7 @@ class userModel extends model public function getList($params = 'nodeleted') { return $this->dao->select('*')->from(TABLE_USER) - ->where(true) + ->where('1=1') ->beginIF(strpos($params, 'all') === false)->andWhere('type')->eq('inside')->fi() ->beginIF(strpos($params, 'nodeleted') !== false)->andWhere('deleted')->eq(0)->fi() ->orderBy('account') diff --git a/test/class/execution.class.php b/test/class/execution.class.php index a773c81725..5c79afdd64 100644 --- a/test/class/execution.class.php +++ b/test/class/execution.class.php @@ -2979,17 +2979,4 @@ class executionTest } return $executionIDList; } - - /** - * Get user custom workflow field. - * - * @param string $moduleName - * @access public - * @return array - */ - public function getExtendFieldsTest($moduleName = 'project') - { - $extendFields = $this->executionModel->getExtendFields($moduleName); - return $extendFields; - } }
    doc->project;?>doc->{$type};?>