Merge branch 'zentaopms_9.8' of github.com:easysoft/zentaopms into zentaopms_9.8

This commit is contained in:
wumo
2018-03-20 14:03:30 +08:00
8 changed files with 49 additions and 17 deletions
+9 -1
View File
@@ -37,7 +37,15 @@ class api extends control
*/
public function getModel($moduleName, $methodName, $params = '')
{
parse_str(str_replace(',', '&', $params), $params);
$params = explode(',', $params);
$newParams = array_shift($params);
foreach($params as $param)
{
$sign = strpos($param, '=') !== false ? '&' : ',';
$newParams .= $sign . $param;
}
parse_str($newParams, $params);
$module = $this->loadModel($moduleName);
$result = call_user_func_array(array(&$module, $methodName), $params);
if(dao::isError()) die(json_encode(dao::getError()));
+11 -3
View File
@@ -82,12 +82,14 @@ class branchModel extends model
*
* @param array $products
* @param string $params
* @param array $appendBranch
* @access public
* @return array
*/
public function getByProducts($products, $params = '')
public function getByProducts($products, $params = '', $appendBranch = '')
{
$branches = $this->dao->select('*')->from(TABLE_BRANCH)->where('product')->in($products)->andWhere('deleted')->eq(0)->orderBy('`order`')->fetchAll();
$branches = $this->dao->select('*')->from(TABLE_BRANCH)->where('product')->in($products)->andWhere('deleted')->eq(0)->orderBy('`order`')->fetchAll('id');
if(!empty($appendBranch)) $branches += $this->dao->select('*')->from(TABLE_BRANCH)->where('id')->in($appendBranch)->orderBy('`order`')->fetchAll('id');
$products = $this->loadModel('product')->getByIdList($products);
$branchGroups = array();
@@ -154,6 +156,12 @@ class branchModel extends model
$case = $this->dao->select('id')->from(TABLE_CASE)->where('branch')->eq($branchID)->andWhere('deleted')->eq(0)->limit(1)->fetch();
$release = $this->dao->select('id')->from(TABLE_RELEASE)->where('branch')->eq($branchID)->andWhere('deleted')->eq(0)->limit(1)->fetch();
$build = $this->dao->select('id')->from(TABLE_BUILD)->where('branch')->eq($branchID)->andWhere('deleted')->eq(0)->limit(1)->fetch();
return empty($module) and empty($story) and empty($bug) and empty($case) and empty($release) and empty($build) and empty($plan);
$project = $this->dao->select('t1.id')->from(TABLE_PROJECT)->alias('t1')
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id=t2.project')
->where('t2.branch')->eq($branchID)
->andWhere('t1.deleted')->eq(0)
->limit(1)
->fetch();
return empty($module) && empty($story) && empty($bug) && empty($case) && empty($release) && empty($build) && empty($plan) && empty($project);
}
}
+4 -4
View File
@@ -88,21 +88,21 @@ $currentBrowseType = isset($lang->bug->mySelects[$browseType]) && in_array($brow
<?php if(isset($menuItem->hidden)) continue;?>
<?php if($this->config->global->flow == 'onlyTest' and $menuItem->name == 'needconfirm') continue;?>
<?php $menuBrowseType = strpos($menuItem->name, 'QUERY') === 0 ? 'bySearch' : $menuItem->name;?>
<?php $param = strpos($menuItem->name, 'QUERY') === 0 ? (int)substr($menuItem->name, 5) : 0;?>
<?php $barParam = strpos($menuItem->name, 'QUERY') === 0 ? (int)substr($menuItem->name, 5) : 0;?>
<?php if($menuItem->name == 'my'):?>
<?php
echo "<li id='statusTab' class='dropdown " . (!empty($currentBrowseType) ? 'active' : '') . "'>";
echo html::a('javascript:;', $menuItem->text . " <span class='caret'></span>", '', "data-toggle='dropdown'");
echo "<ul class='dropdown-menu'>";
foreach ($lang->bug->mySelects as $key => $value)
foreach($lang->bug->mySelects as $key => $value)
{
echo '<li' . ($key == $currentBrowseType ? " class='active'" : '') . '>';
echo html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=$key&param=$param"), $value);
echo html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=$key&param=$barParam"), $value);
}
echo '</ul></li>';
?>
<?php else:?>
<li id='<?php echo $menuItem->name?>Tab'><?php echo html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=$menuBrowseType&param=$param"), $menuItem->text)?></li>
<li id='<?php echo $menuItem->name?>Tab'><?php echo html::a($this->createLink('bug', 'browse', "productid=$productID&branch=$branch&browseType=$menuBrowseType&param=$barParam"), $menuItem->text)?></li>
<?php endif;?>
<?php endforeach;?>
<li id='bysearchTab'><a href='#'><i class='icon-search icon'></i>&nbsp;<?php echo $lang->bug->byQuery;?></a></li>
+1 -1
View File
@@ -15,7 +15,7 @@ $(function()
return $(this).each(function()
{
var $this = $(this);
if($this.offset().top + 200 > $(document.body).height())
if(!$this.data('pickerPosition') && $this.offset().top + 200 > $(document.body).height())
{
$this.attr('data-picker-position', 'top-right');
}
+3 -3
View File
@@ -33,7 +33,7 @@
<?php foreach(customModel::getFeatureMenu($this->moduleName, $this->methodName) as $menuItem):?>
<?php if(isset($menuItem->hidden)) continue;?>
<?php $menuBrowseType = strpos($menuItem->name, 'QUERY') === 0 ? 'bySearch' : $menuItem->name;?>
<?php $param = strpos($menuItem->name, 'QUERY') === 0 ? '&param=' . (int)substr($menuItem->name, 5) : '';?>
<?php $barParam = strpos($menuItem->name, 'QUERY') === 0 ? '&param=' . (int)substr($menuItem->name, 5) : '';?>
<?php if($menuItem->name == 'my'):?>
<?php
echo "<li id='statusTab' class='dropdown " . (!empty($currentBrowseType) ? 'active' : '') . "'>";
@@ -42,12 +42,12 @@
foreach ($lang->product->mySelects as $key => $value)
{
echo '<li' . ($key == $currentBrowseType ? " class='active'" : '') . '>';
echo html::a($this->inlink('browse', "productID=$productID&branch=$branch&browseType=$key" . $param), $value);
echo html::a($this->inlink('browse', "productID=$productID&branch=$branch&browseType=$key" . $barParam), $value);
}
echo '</ul></li>';
?>
<?php else:?>
<li id='<?php echo $menuItem->name?>Tab'><?php echo html::a($this->inlink('browse', "productID=$productID&branch=$branch&browseType=$menuBrowseType" . $param), $menuItem->text);?></li>
<li id='<?php echo $menuItem->name?>Tab'><?php echo html::a($this->inlink('browse', "productID=$productID&branch=$branch&browseType=$menuBrowseType" . $barParam), $menuItem->text);?></li>
<?php endif;?>
<?php endforeach;?>
<li id='bysearchTab'><a href='javascript:;'><i class='icon-search icon'></i> <?php echo $lang->product->searchStory;?></a></li>
+12 -3
View File
@@ -1025,9 +1025,11 @@ class project extends control
$allProducts = array(0 => '') + $this->loadModel('product')->getPairs('noclosed|nocode');
$linkedProducts = $this->project->getProducts($project->id);
$linkedBranches = array();
foreach($linkedProducts as $product)
{
if(!isset($allProducts[$product->id])) $allProducts[$product->id] = $product->name;
if($product->branch) $linkedBranches[$product->branch] = $product->branch;
}
$this->view->title = $title;
@@ -1041,7 +1043,7 @@ class project extends control
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->allProducts = $allProducts;
$this->view->linkedProducts = $linkedProducts;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts));
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts), '', $linkedBranches);
$this->display();
}
@@ -1291,6 +1293,11 @@ class project extends control
if(!$project) die(js::error($this->lang->notFound) . js::locate('back'));
$products = $this->project->getProducts($project->id);
$linkedBranches = array();
foreach($products as $product)
{
if($product->branch) $linkedBranches[$product->branch] = $product->branch;
}
/* Set menu. */
$this->project->setMenu($this->projects, $project->id);
@@ -1301,7 +1308,7 @@ class project extends control
$this->view->project = $project;
$this->view->products = $products;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products));
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), '', $linkedBranches);
$this->view->planGroups = $this->project->getPlans($products);
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->actions = $this->loadModel('action')->getList('project', $projectID);
@@ -1599,10 +1606,12 @@ class project extends control
$allProducts = $this->product->getPairs('noclosed|nocode');
$linkedProducts = $this->project->getProducts($project->id);
$linkedBranches = array();
// Merge allProducts and linkedProducts for closed product.
foreach($linkedProducts as $product)
{
if(!isset($allProducts[$product->id])) $allProducts[$product->id] = $product->name;
if(!empty($product->branch)) $linkedBranches[$product->branch] = $product->branch;
}
/* Assign. */
@@ -1610,7 +1619,7 @@ class project extends control
$this->view->position = $position;
$this->view->allProducts = $allProducts;
$this->view->linkedProducts = $linkedProducts;
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($allProducts));
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($allProducts), '', $linkedBranches);
$this->display();
}
+8 -1
View File
@@ -238,8 +238,15 @@ class searchModel extends model
$query->form = htmlspecialchars_decode($query->form, ENT_QUOTES);
$query->sql = htmlspecialchars_decode($query->sql, ENT_QUOTES);
$hasDynamic = strpos($query->form, '$') !== false;
$query->form = unserialize($query->form);
$query->sql = $this->replaceDynamic($query->sql);
if($hasDynamic)
{
$_POST = $query->form;
$this->buildQuery();
$querySessionName = $query->form['module'] . 'Query';
$query->sql = $this->session->$querySessionName;
}
return $query;
}
+1 -1
View File
@@ -33,7 +33,7 @@
<table class='table table-form'>
<tr>
<th class='w-80px'><?php echo $lang->task->realStarted;?></th>
<td class='w-p25-f'><div class='datepicker-wrapper datepicker-date'><?php echo html::input('realStarted', $task->realStarted == '0000-00-00' ? helper::today() : $task->realStarted, "class='form-control form-date'");?></div></td><td></td>
<td class='w-p25-f'><div class='datepicker-wrapper datepicker-date'><?php echo html::input('realStarted', $task->realStarted == '0000-00-00' ? helper::today() : $task->realStarted, "class='form-control form-date' data-picker-position='bottom-right'");?></div></td><td></td>
</tr>
<tr>
<th><?php echo $lang->task->consumed;?></th>