* Fix dynamic bug.

This commit is contained in:
zhujinyong
2021-03-24 18:06:47 +08:00
parent c24d011380
commit 2d68f7dd45
23 changed files with 61 additions and 21 deletions
+17 -4
View File
@@ -762,6 +762,7 @@ class actionModel extends model
* Get dynamic by search.
*
* @param array $products
* @param array $projects
* @param array $executions
* @param int $queryID
* @param string $orderBy
@@ -771,7 +772,7 @@ class actionModel extends model
* @access public
* @return array
*/
public function getDynamicBySearch($products, $executions, $queryID, $orderBy = 'date_desc', $pager = null, $date = '', $direction = 'next')
public function getDynamicBySearch($products, $projects, $executions, $queryID, $orderBy = 'date_desc', $pager = null, $date = '', $direction = 'next')
{
$query = $queryID ? $this->loadModel('search')->getQuery($queryID) : '';
@@ -783,7 +784,8 @@ class actionModel extends model
}
if($this->session->actionQuery == false) $this->session->set('actionQuery', ' 1 = 1');
$allProduct = "`product` = 'all'";
$allProducts = "`product` = 'all'";
$allProjects = "`project` = 'all'";
$allExecutions = "`execution` = 'all'";
$actionQuery = $this->session->actionQuery;
@@ -792,14 +794,25 @@ class actionModel extends model
{
$productID = $out[1];
}
/* If the sql not include 'product', add check purview for product. */
if(strpos($actionQuery, $allProduct) === false)
if(strpos($actionQuery, $allProducts) === false)
{
if(!in_array($productID, array_keys($products))) return array();
}
else
{
$actionQuery = str_replace($allProduct, '1', $actionQuery);
$actionQuery = str_replace($allProducts, '1', $actionQuery);
}
/* If the sql not include 'project', add check purview for project. */
if(strpos($actionQuery, $allProjects) === false)
{
$actionQuery = $actionQuery . ' AND `project`' . helper::dbIN(array_keys($projects));
}
else
{
$actionQuery = str_replace($allProjects, '1', $actionQuery);
}
/* If the sql not include 'execution', add check purview for execution. */
+3 -1
View File
@@ -213,6 +213,8 @@ $lang->doc->project = 'Project';
$lang->doc->custom = 'Custom';
$lang->doc->wiki = 'WIKI';
$lang->product->list = $lang->productCommon . ' List';
$lang->project->report = 'Report';
$lang->report->weekly = 'Weekly';
@@ -234,7 +236,7 @@ $lang->admin->data = 'Data';
$lang->admin->cron = 'Cron';
$lang->admin->buildIndex = 'Full Text Search';
$lang->subject->storyConcept = 'Story Concpet';
$lang->storyConcept = 'Story Concpet';
$lang->searchTips = '';
$lang->searchAB = 'Search';
+1 -1
View File
@@ -128,7 +128,7 @@ $lang->program->menu->personnel['subMenu']->whitelist = array('link' => "{$lang
/* Product menu. */
$lang->product->homeMenu = new stdclass();
$lang->product->homeMenu->home = array('link' => "{$lang->dashboard}|product|index|");
$lang->product->homeMenu->list = array('link' => $lang->productCommon . '|product|all|', 'alias' => 'create,batchedit,manageline');
$lang->product->homeMenu->list = array('link' => $lang->product->list . '|product|all|', 'alias' => 'create,batchedit,manageline');
$lang->product->menu = new stdclass();
$lang->product->menu->dashboard = array('link' => "{$lang->dashboard}|product|dashboard|productID=%s");
+2
View File
@@ -213,6 +213,8 @@ $lang->doc->project = '项目库';
$lang->doc->custom = '自定义库';
$lang->doc->wiki = 'WIKI';
$lang->product->list = $lang->productCommon . '列表';
$lang->project->report = '报告';
$lang->report->weekly = '周报';
+4 -2
View File
@@ -9,17 +9,19 @@ $app->loadLang('user');
$config->company->dynamic = new stdclass();
$config->company->dynamic->search['module'] = 'action';
$config->company->dynamic->search['fields']['product'] = $lang->action->product;
$config->company->dynamic->search['fields']['project'] = '项目';
$config->company->dynamic->search['fields']['execution'] = $lang->action->execution;
$config->company->dynamic->search['fields']['actor'] = $lang->action->actor;
$config->company->dynamic->search['fields']['objectID'] = $lang->action->objectID;
$config->company->dynamic->search['fields']['execution'] = $lang->action->execution;
$config->company->dynamic->search['fields']['objectType'] = $lang->action->objectType;
$config->company->dynamic->search['fields']['date'] = $lang->action->date;
$config->company->dynamic->search['fields']['action'] = $lang->action->action;
$config->company->dynamic->search['params']['product'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->company->dynamic->search['params']['project'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->company->dynamic->search['params']['execution'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->company->dynamic->search['params']['actor'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->company->dynamic->search['params']['objectID'] = array('operator' => '=', 'control' => 'input', 'values' => '');
$config->company->dynamic->search['params']['execution'] = array('operator' => '=', 'control' => 'select', 'values' => '');
$config->company->dynamic->search['params']['objectType'] = array('operator' => '=', 'control' => 'select', 'values' => $lang->action->search->objectTypeList);
$config->company->dynamic->search['params']['date'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date');
$config->company->dynamic->search['params']['action'] = array('operator' => '=', 'control' => 'select', 'values' => '');
+10 -3
View File
@@ -205,7 +205,7 @@ class company extends control
$product = $browseType == 'product' ? $param : 'all';
$project = $browseType == 'project' ? $param : 'all';
$execution = $browseType == 'execution' ? $param : 'all';
$period = ($browseType == 'account' or $browseType == 'product' or $browseType == 'execution') ? 'all' : $browseType;
$period = in_array($browseType, array('account', 'product', 'project', 'execution')) ? 'all' : $browseType;
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
$date = empty($date) ? '' : date('Y-m-d', $date);
@@ -214,6 +214,11 @@ class company extends control
$products = array($this->lang->company->product) + $products;
$this->view->products = $products;
/* Get projects' list.*/
$projects = $this->loadModel('project')->getPairsByProgram(0);
$projects = array($this->lang->company->project) + $projects;
$this->view->projects = $projects;
/* Get executions' list.*/
$executions = $this->loadModel('execution')->getPairs(0, 'all', 'nocode');
$executions = array($this->lang->company->execution) + $executions;
@@ -238,7 +243,7 @@ class company extends control
}
else
{
$actions = $this->action->getDynamicBySearch($products, $executions, $queryID, $sort, $pager, $date, $direction);
$actions = $this->action->getDynamicBySearch($products, $projects, $executions, $queryID, $sort, $pager, $date, $direction);
}
/* Build search form. */
@@ -257,8 +262,9 @@ class company extends control
$this->config->company->dynamic->search['actionURL'] = $this->createLink('company', 'dynamic', "browseType=bysearch&param=myQueryID");
$this->config->company->dynamic->search['queryID'] = $queryID;
$this->config->company->dynamic->search['params']['action']['values'] = $this->lang->action->search->label;
$this->config->company->dynamic->search['params']['execution']['values'] = $executions;
$this->config->company->dynamic->search['params']['product']['values'] = $products;
$this->config->company->dynamic->search['params']['project']['values'] = $projects;
$this->config->company->dynamic->search['params']['execution']['values'] = $executions;
$this->config->company->dynamic->search['params']['actor']['values'] = $accountPairs;
$this->loadModel('search')->setSearchParams($this->config->company->dynamic->search);
@@ -267,6 +273,7 @@ class company extends control
$this->view->account = $account;
$this->view->accountPairs = $accountPairs;
$this->view->product = $product;
$this->view->project = $project;
$this->view->execution = $execution;
$this->view->queryID = $queryID;
$this->view->orderBy = $orderBy;
+13 -5
View File
@@ -10,13 +10,21 @@ function changeUser(account)
}
location.href = link;
}
function changeExecution(execution)
{
link = createLink('company', 'dynamic', 'type=execution&param=' + execution);
location.href = link;
}
function changeProduct(product)
{
link = createLink('company', 'dynamic', 'type=product&param=' + product);
location.href = link;
}
function changeProject(project)
{
link = createLink('company', 'dynamic', 'type=project&param=' + project);
location.href = link;
}
function changeExecution(execution)
{
link = createLink('company', 'dynamic', 'type=execution&param=' + execution);
location.href = link;
}
+1
View File
@@ -29,6 +29,7 @@ $lang->company->guest = 'Gast Login';
$lang->company->admins = 'Administratoren';
$lang->company->product = $lang->productCommon;
$lang->company->project = 'Project';
$lang->company->execution = $lang->executionCommon;
$lang->company->user = 'Benutzer';
+1
View File
@@ -29,6 +29,7 @@ $lang->company->guest = 'Guest Login';
$lang->company->admins = 'Administrator';
$lang->company->product = $lang->productCommon;
$lang->company->project = 'Project';
$lang->company->execution = $lang->executionCommon;
$lang->company->user = 'User';
+1
View File
@@ -29,6 +29,7 @@ $lang->company->guest = 'Connexion Invités';
$lang->company->admins = 'Administrateur';
$lang->company->product = $lang->productCommon;
$lang->company->project = 'Project';
$lang->company->execution = $lang->executionCommon;
$lang->company->user = 'Utilisateurs';
+1
View File
@@ -29,6 +29,7 @@ $lang->company->guest = 'Khách truy cập';
$lang->company->admins = 'Quản trị viên';
$lang->company->product = $lang->productCommon;
$lang->company->project = 'Project';
$lang->company->execution = $lang->executionCommon;
$lang->company->user = 'Người dùng';
+1
View File
@@ -29,6 +29,7 @@ $lang->company->guest = '匿名登录';
$lang->company->admins = '管理员';
$lang->company->product = $lang->productCommon;
$lang->company->project = '项目';
$lang->company->execution = $lang->executionCommon;
$lang->company->user = '用户';
+1
View File
@@ -27,6 +27,7 @@
<?php endforeach;?>
<div class="input-control space w-150px"><?php echo html::select('account', $userIdPairs, $user ? $user->id : '', 'onchange=changeUser(this.value) class="form-control chosen"');?></div>
<div class="input-control space w-150px"><?php echo html::select('product', $products, $product, 'onchange=changeProduct(this.value) class="form-control chosen"');?></div>
<div class="input-control space w-150px"><?php echo html::select('project', $projects, $project, 'onchange=changeProject(this.value) class=form-control chosen"');?></div>
<div class="input-control space w-150px"><?php echo html::select('execution', $executions, $execution, 'onchange=changeExecution(this.value) class="form-control chosen"'); ?></div>
<a class="btn btn-link querybox-toggle" id="bysearchTab"><i class="icon icon-search muted"></i> <?php echo $lang->action->dynamic->search;?></a>
</div>
+1
View File
@@ -52,6 +52,7 @@ $lang->program->beginGreateChild = "Child earliest begin: %s, parent begi
$lang->program->endLetterChild = "Child latest end: %s, parent end date > = child latest end date.";
$lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed';
$lang->program->confirmDelete = "Do you want to delete it?";
$lang->program->hasChildren = 'It has child programs or projects. You cannot delete it.';
$lang->program->readjustTime = 'Change the program begin&end date.';
$lang->program->stakeholderTypeList['inside'] = 'Inside';
+1
View File
@@ -52,6 +52,7 @@ $lang->program->beginGreateChild = "Child earliest begin: %s, parent begi
$lang->program->endLetterChild = "Child latest end: %s, parent end date > = child latest end date.";
$lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed';
$lang->program->confirmDelete = "Do you want to delete it?";
$lang->program->hasChildren = 'It has child programs or projects. You cannot delete it.';
$lang->program->readjustTime = 'Change the program begin&end date.';
$lang->program->stakeholderTypeList['inside'] = 'Inside';
+1
View File
@@ -52,6 +52,7 @@ $lang->program->beginGreateChild = "Child earliest begin: %s, parent begi
$lang->program->endLetterChild = "Child latest end: %s, parent end date > = child latest end date.";
$lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed';
$lang->program->confirmDelete = "Do you want to delete it?";
$lang->program->hasChildren = 'It has child programs or projects. You cannot delete it.';
$lang->program->readjustTime = 'Change the program begin&end date.';
$lang->program->stakeholderTypeList['inside'] = 'Inside';
+1
View File
@@ -52,6 +52,7 @@ $lang->program->beginGreateChild = "Child earliest begin: %s, parent begi
$lang->program->endLetterChild = "Child latest end: %s, parent end date > = child latest end date.";
$lang->program->closeErrorMessage = 'There are subprograms or projects that are not closed';
$lang->program->confirmDelete = "Do you want to delete it?";
$lang->program->hasChildren = 'It has child programs or projects. You cannot delete it.';
$lang->program->readjustTime = 'Change the program begin&end date.';
$lang->program->stakeholderTypeList['inside'] = 'Inside';
+1
View File
@@ -51,6 +51,7 @@ $lang->program->endGreaterParent = "父项目集的完成日期:%s,
$lang->program->beginGreateChild = "子项目集的最小开始日期:%s,父项目集的开始日期不能大于子项目集的最小开始日期";
$lang->program->endLetterChild = "子项目的最大完成日期:%s,父项目的完成日期不能小于子项目的最大完成日期";
$lang->program->closeErrorMessage = '存在子项目集或项目为未关闭状态';
$lang->program->hasChildren = '该项目集有子项目集或项目存在,不能删除。';
$lang->program->confirmDelete = "您确定要删除吗?";
$lang->program->readjustTime = '重新调整项目集起止时间';
-1
View File
@@ -190,7 +190,6 @@ $lang->project->scrum = 'Scrum';
$lang->project->waterfall = 'CMMI';
$lang->project->waterfallTitle = 'CMMI';
$lang->project->cannotCreateChild = 'It is not empty, so you cannot add a child. You can add a parent for it, and then create a child.';
$lang->project->hasChildren = 'It has child projects or projects. You cannot delete it.';
$lang->project->confirmDelete = "Do you want to delete [%s]?";
$lang->project->emptyPM = 'No manager';
$lang->project->cannotChangeToCat = "It is not empty, so you cannot change it to a parent.";
-1
View File
@@ -190,7 +190,6 @@ $lang->project->scrum = 'Scrum';
$lang->project->waterfall = 'CMMI';
$lang->project->waterfallTitle = 'CMMI';
$lang->project->cannotCreateChild = 'It is not empty, so you cannot add a child. You can add a parent for it, and then create a child.';
$lang->project->hasChildren = 'It has child projects or projects. You cannot delete it.';
$lang->project->confirmDelete = "Do you want to delete [%s]?";
$lang->project->emptyPM = 'No manager';
$lang->project->cannotChangeToCat = "It is not empty, so you cannot change it to a parent.";
-1
View File
@@ -190,7 +190,6 @@ $lang->project->scrum = 'Scrum';
$lang->project->waterfall = 'CMMI';
$lang->project->waterfall = 'CMMI';
$lang->project->cannotCreateChild = 'It is not empty, so you cannot add a child. You can add a parent for it, and then create a child.';
$lang->project->hasChildren = 'It has child projects or projects. You cannot delete it.';
$lang->project->confirmDelete = "Do you want to delete [%s]?";
$lang->project->emptyPM = 'No manager';
$lang->project->cannotChangeToCat = "It is not empty, so you cannot change it to a parent.";
-1
View File
@@ -190,7 +190,6 @@ $lang->project->scrum = 'Scrum';
$lang->project->waterfall = 'CMMI';
$lang->project->waterfallTitle = 'CMMI';
$lang->project->cannotCreateChild = 'It is not empty, so you cannot add a child. You can add a parent for it, and then create a child.';
$lang->project->hasChildren = 'It has child projects or projects. You cannot delete it.';
$lang->project->confirmDelete = "Do you want to delete [%s]?";
$lang->project->emptyPM = 'No manager';
$lang->project->cannotChangeToCat = "It is not empty, so you cannot change it to a parent.";
-1
View File
@@ -191,7 +191,6 @@ $lang->project->scrum = 'Scrum';
$lang->project->waterfall = '瀑布';
$lang->project->waterfallTitle = '瀑布式项目管理';
$lang->project->cannotCreateChild = '该项目已经有实际的内容,无法直接添加子项目。您可以为当前项目创建一个父项目,然后在新的父项目下面添加子项目。';
$lang->project->hasChildren = '该项目集有子项目集或项目存在,不能删除。';
$lang->project->confirmDelete = "您确定要删除吗?";
$lang->project->emptyPM = '暂无';
$lang->project->cannotChangeToCat = "该项目已经有实际的内容,无法修改为父项目";