This commit is contained in:
wangyidong
2023-04-25 08:58:46 +08:00
10 changed files with 44 additions and 43 deletions
@@ -25,7 +25,7 @@ public function getPairs($mode = '', $programID = 0, $append = '', $shadow = 0)
->andWhere('t2.vision')->eq($this->config->vision)
->fetchPairs('id', 'id');
$products = $this->dao->select('*, IF(INSTR(" closed", status) < 2, 0, 1) AS isClosed')
$products = $this->dao->select("*, IF(INSTR(' closed', status) < 2, 0, 1) AS isClosed")
->from(TABLE_PRODUCT)
->where(1)
->beginIF(strpos($mode, 'all') === false)->andWhere('deleted')->eq(0)->fi()
+1 -1
View File
@@ -45,7 +45,7 @@ class dbh
*/
public function __construct($config, $setSchema = true)
{
$dsn = "{$config->driver}:host={$config->host}:{$config->port}";
$dsn = "{$config->driver}:host={$config->host};port={$config->port}";
if($setSchema) $dsn .= ";dbname={$config->name}";
$pdo = new PDO($dsn, $config->user, $config->password);
+2 -2
View File
@@ -254,7 +254,7 @@ class buildModel extends model
$buildIdList = str_replace('trunk', '0', $buildIdList);
$selectedBuilds = $this->dao->select('id, name')->from(TABLE_BUILD)
->where('id')->in($buildIdList)
->beginIF($products)->andWhere('product')->in($productIdList)->fi()
->beginIF($products and $products != 'all')->andWhere('product')->in($productIdList)->fi()
->beginIF($objectType === 'execution' and $objectID)->andWhere('execution')->eq($objectID)->fi()
->beginIF($objectType === 'project' and $objectID)->andWhere('project')->eq($objectID)->fi()
->beginIF(strpos($params, 'hasdeleted') === false)->andWhere('deleted')->eq(0)->fi()
@@ -274,7 +274,7 @@ class buildModel extends model
->beginIF(strpos($params, 'hasdeleted') === false)->andWhere('t1.deleted')->eq(0)->fi()
->beginIF(strpos($params, 'hasproject') !== false)->andWhere('t1.project')->ne(0)->fi()
->beginIF(strpos($params, 'singled') !== false)->andWhere('t1.execution')->ne(0)->fi()
->beginIF($products)->andWhere('t1.product')->in($productIdList)->fi()
->beginIF($products and $products != 'all')->andWhere('t1.product')->in($productIdList)->fi()
->beginIF($objectType === 'execution' and $objectID)->andWhere('t1.execution')->eq($objectID)->fi()
->beginIF($objectType === 'project' and $objectID)->andWhere('t1.project')->eq($objectID)->fi()
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
+1 -1
View File
@@ -3319,7 +3319,7 @@ class executionModel extends model
$data->branch = $storyList[$storyID]->branch;
$data->story = $storyID;
$data->version = $versions[$storyID];
$data->order = ++$lastOrder;
$data->order = (int)++$lastOrder;
$this->dao->replace(TABLE_PROJECTSTORY)->data($data)->exec();
$this->story->setStage($storyID);
+1 -1
View File
@@ -18,6 +18,6 @@ function changeParams(obj)
}
var params = window.btoa('begin=' + begin + '&end=' + end + '&product=' + product + '&execution=' + execution);
var link = createLink('pivot', 'preview', 'dimension=' + dimension + '&group=' + group + '&module=pivot&method=bugcreate&params=' + params);
var link = createLink('pivot', 'preview', 'dimension=' + dimension + '&group=' + groupID + '&module=pivot&method=bugcreate&params=' + params);
location.href = link;
}
+1 -1
View File
@@ -8,6 +8,6 @@ $('#conditions input:checkbox').change(function()
conditions = conditions.substring(0, conditions.length - 1);
var params = window.btoa('conditions=' + conditions);
var link = createLink('pivot', 'preview', 'dimension=' + dimension + '&group=' + group + '&module=pivot&method=productSummary&params=' + params);
var link = createLink('pivot', 'preview', 'dimension=' + dimension + '&group=' + groupID + '&module=pivot&method=productSummary&params=' + params);
location.href = link;
})
+1 -1
View File
@@ -31,6 +31,6 @@ function changeDate(begin, end)
}
var params = window.btoa('begin=' + begin + '&end=' + end);
var link = createLink('pivot', 'preview', 'dimension=' + dimension + '&group=' + group + '&module=pivot&method=projectdeviation&params=' + params);
var link = createLink('pivot', 'preview', 'dimension=' + dimension + '&group=' + groupID + '&module=pivot&method=projectdeviation&params=' + params);
location.href = link;
}
+1 -1
View File
@@ -23,7 +23,7 @@ function changeParams(obj)
}
var params = window.btoa('begin=' + begin + '&end=' + end + '&days=' + days + '&workday=' + workday + '&dept=' + dept + '&assign=' + assign);
var link = createLink('pivot', 'preview', 'dimension=' + dimension + '&group=' + group + '&module=pivot&method=workload&params=' + params);
var link = createLink('pivot', 'preview', 'dimension=' + dimension + '&group=' + groupID + '&module=pivot&method=workload&params=' + params);
location.href = link;
}
+34 -34
View File
@@ -1390,19 +1390,16 @@ class pivotModel extends model
/* Process rows. */
$connectSQL = '';
if(empty($settings['filterType']) or $settings['filterType'] == 'result')
if(!empty($filters) && !isset($filters[0]['from']))
{
if(!empty($filters))
$wheres = array();
foreach($filters as $field => $filter)
{
$wheres = array();
foreach($filters as $field => $filter)
{
$wheres[] = "tt.`$field` {$filter['operator']} {$filter['value']}";
}
$whereStr = implode(' and ', $wheres);
$connectSQL .= " where $whereStr";
$wheres[] = "tt.`$field` {$filter['operator']} {$filter['value']}";
}
$whereStr = implode(' and ', $wheres);
$connectSQL .= " where $whereStr";
}
$groupSQL = " group by $groupList";
@@ -1411,36 +1408,39 @@ class pivotModel extends model
$number = 0;
$groupsRow = array();
$showColTotal = zget($settings, 'columnTotal', 'noShow');
foreach($settings['columns'] as $column)
if(isset($settings['columns']))
{
$stat = $column['stat'];
$field = $column['field'];
$slice = zget($column, 'slice', 'noSlice');
$uuName = $field . $number;
$number ++;
if($stat == 'distinct')
foreach($settings['columns'] as $column)
{
$columnSQL = "count(distinct tt.`$field`) as `$uuName`";
}
else
{
$columnSQL = "$stat(tt.`$field`) as `$uuName`";
}
$stat = $column['stat'];
$field = $column['field'];
$slice = zget($column, 'slice', 'noSlice');
$uuName = $field . $number;
$number ++;
if($slice != 'noSlice') $columnSQL = "select $groupList,`$slice`,$columnSQL from ($sql) tt" . $connectSQL . $groupSQL . ",tt.`$slice`" . $orderSQL . ",tt.`$slice`";
if($slice == 'noSlice') $columnSQL = "select $groupList,$columnSQL from ($sql) tt" . $connectSQL . $groupSQL . $orderSQL;
if($stat == 'distinct')
{
$columnSQL = "count(distinct tt.`$field`) as `$uuName`";
}
else
{
$columnSQL = "$stat(tt.`$field`) as `$uuName`";
}
$columnRows = $this->dao->query($columnSQL)->fetchAll();
if($slice != 'noSlice') $columnSQL = "select $groupList,`$slice`,$columnSQL from ($sql) tt" . $connectSQL . $groupSQL . ",tt.`$slice`" . $orderSQL . ",tt.`$slice`";
if($slice == 'noSlice') $columnSQL = "select $groupList,$columnSQL from ($sql) tt" . $connectSQL . $groupSQL . $orderSQL;
$cols = $this->getTableHeader($columnRows, $column, $fields, $cols, $sql, $langs);
if($slice != 'noSlice') $columnRows = $this->processSliceData($columnRows, $groups, $slice, $uuName);
$columnRows = $this->processShowData($columnRows, $groups, $column, $showColTotal, $uuName);
$columnRows = $this->dao->query($columnSQL)->fetchAll();
foreach($columnRows as $key => $row)
{
if(!isset($groupsRow[$key])) $groupsRow[$key] = new stdclass();
$groupsRow[$key] = (object)array_merge((array)$groupsRow[$key], (array)$row);
$cols = $this->getTableHeader($columnRows, $column, $fields, $cols, $sql, $langs);
if($slice != 'noSlice') $columnRows = $this->processSliceData($columnRows, $groups, $slice, $uuName);
$columnRows = $this->processShowData($columnRows, $groups, $column, $showColTotal, $uuName);
foreach($columnRows as $key => $row)
{
if(!isset($groupsRow[$key])) $groupsRow[$key] = new stdclass();
$groupsRow[$key] = (object)array_merge((array)$groupsRow[$key], (array)$row);
}
}
}
+1
View File
@@ -244,6 +244,7 @@ class productModel extends model
*/
public function getById($productID)
{
$productID = (int)$productID;
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProduct();
$product = $this->dao->findById($productID)->from(TABLE_PRODUCT)->fetch();
if(!$product) return false;