Merge branch 'sprint/186_tianshujie_19786' into 'master'

Sprint/186 tianshujie 19786

See merge request easycorp/zentaopms!2032
This commit is contained in:
孙广明
2022-03-02 00:37:29 +00:00
7 changed files with 46 additions and 23 deletions
+5 -5
View File
@@ -87,15 +87,15 @@ public function getTRActions($currentMethod)
foreach($subMenu as $key => $value)
{
$tmpValue = explode('|', $value['link']);
$subMenu->$key['name'] = $tmpValue[0];
$subMenu->$key['module'] = $tmpValue[1];
$subMenu->$key['method'] = $tmpValue[2];
$subMenu->$key['vars'] = $tmpValue[3];
$subMenu->{$key}['name'] = $tmpValue[0];
$subMenu->{$key}['module'] = $tmpValue[1];
$subMenu->{$key}['method'] = $tmpValue[2];
$subMenu->{$key}['vars'] = $tmpValue[3];
}
$TRActions = '';
$TRActions .= "<div class='dropdown'>";
$TRActions .= html::a('javascript:;', "<i class='icon icon-" . $this->lang->execution->icons[$currentMethod]."'></i> " . $subMenu->$currentMethod['name'] . "<span class='caret'></span>", '', "data-toggle='dropdown' class='btn btn-link'");
$TRActions .= html::a('javascript:;', "<i class='icon icon-" . $this->lang->execution->icons[$currentMethod]."'></i> " . $subMenu->{$currentMethod}['name'] . "<span class='caret'></span>", '', "data-toggle='dropdown' class='btn btn-link'");
$TRActions .= "<ul class='dropdown-menu pull-right'>";
foreach($subMenu as $subKey => $subName)
{
+31 -10
View File
@@ -506,22 +506,42 @@ class commonModel extends model
{
global $app, $config, $lang;
$html = "<ul class='dropdown-menu pull-right create-list'>";
$html = "<ul class='dropdown-menu pull-right create-list'>";
/* Initialize the default values. */
$showCreateList = $needPrintDivider = false;
/* Get default product id. */
$deletedProducts = $app->dbh->query("SELECT id FROM " . TABLE_PRODUCT . " WHERE `deleted` = '1'")->fetchAll();
$deletedProductIds = array();
foreach($deletedProducts as $product) $deletedProductIds[] = $product->id;
$productID = (isset($_SESSION['product']) and !in_array($_SESSION['product'], $deletedProductIds)) ? $_SESSION['product'] : 0;
if(!$productID and $app->user->view->products)
if($config->vision == 'rnd')
{
$viewProducts = explode(',', $app->user->view->products);
$viewProducts = array_diff($viewProducts, $deletedProductIds);
$productID = current($viewProducts);
$deletedProducts = $app->dbh->query("SELECT id FROM " . TABLE_PRODUCT . " WHERE `deleted` = '1'")->fetchAll();
$deletedProductIds = array();
foreach($deletedProducts as $product) $deletedProductIds[] = $product->id;
$productID = (isset($_SESSION['product']) and !in_array($_SESSION['product'], $deletedProductIds)) ? $_SESSION['product'] : 0;
if(!$productID and $app->user->view->products)
{
$viewProducts = explode(',', $app->user->view->products);
$viewProducts = array_diff($viewProducts, $deletedProductIds);
$productID = current($viewProducts);
}
}
else
{
$queryProduct = $app->user->admin ? " where `deleted` = '0' and `vision` = 'lite'" : " where `deleted` = '0' and `vision` = 'lite' and `id` in ({$app->user->view->products})";
$product = $app->dbh->query("select id FROM " . TABLE_PRODUCT . $queryProduct)->fetch();
$productID = empty($product) ? 0 : $product->id;
}
$object = '';
if($config->vision == 'lite')
{
$condition = " where `deleted` = '0' ";
$condition .= $config->systemMode == 'new' ? "and `model` = 'kanban' " : "and `type` = 'kanban' ";
$condition .= (!$app->user->admin and $config->systemMode == 'new') ? "and `id` in({$app->user->view->sprints}) " : '';
$condition .= (!$app->user->admin and $config->systemMode == 'classic') ? "and `id` in({$app->user->view->projects}) " : '';
$object = $app->dbh->query("select id from " . TABLE_PROJECT . $condition)->fetch();
}
/* Check whether the creation permission is available, and print create buttons. */
@@ -530,6 +550,7 @@ class commonModel extends model
if($config->edition == 'open' and $objectType == 'effort') continue;
if($config->systemMode == 'classic' and strpos('project|program', $objectType) !== false) continue;
if(!empty($_COOKIE['feedbackView']) and strpos('todo|effort', $objectType) === false) continue;
if($config->vision == 'lite' and empty($object) and in_array($objectType, array('story', 'task', 'execution'))) continue;
/* Change icon when object type is execution and mode is classic. */
if($config->systemMode == 'classic' and $objectType == 'execution') $objectIcon = 'project';
-1
View File
@@ -112,7 +112,6 @@ class project extends control
->where('type')->eq('project')
->beginIF($this->config->vision)->andWhere('vision')->eq($this->config->vision)->fi()
->andWhere('deleted')->eq(0)
->andWhere('vision')->eq($this->config->vision)
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects)->fi()
->orderBy('order_asc')
->fetchAll('id');
+2
View File
@@ -56,6 +56,8 @@ class story extends control
else if($this->app->tab == 'project')
{
$objectID = empty($objectID) ? $this->session->project : $objectID;
$objects = $this->project->getPairsByProgram();
$objectID = $this->project->saveState($objectID, $objects);
$this->project->setMenu($objectID);
}
else if($this->app->tab == 'execution')
+1 -1
View File
@@ -395,7 +395,7 @@ class todo extends control
$this->loadModel('user');
$model = $todo->type == 'opportunity' ? 'waterfall' : 'all';
$model = $todo->type == 'opportunity' ? 'waterfall' : 'all';
$projects = $this->loadModel('project')->getPairsByModel($model);
if(!isset($this->session->project)) $this->session->set('project', key($projects));
+4 -4
View File
@@ -80,8 +80,8 @@ function createProject()
var link = createLink('project', 'create');
config.onlybody = onlybody;
parent.location.href = link;
config.onlybody = onlybody;
window.parent.$.apps.open(link, 'project');
}
/**
@@ -97,8 +97,8 @@ function createExecution()
var link = createLink('execution', 'create');
config.onlybody = onlybody;
parent.location.href = link;
config.onlybody = onlybody;
window.parent.$.apps.open(link, 'execution');
}
/**
+3 -2
View File
@@ -77,7 +77,8 @@
$createStoryPriv = common::hasPriv('story', 'create');
$createTaskPriv = common::hasPriv('task', 'create');
$createBugPriv = common::hasPriv('bug', 'create');
if($createStoryPriv or $createTaskPriv or $createBugPriv)
$printBtn = ($config->vision == 'lite' and (($config->systemMode == 'new' and empty($projects) or $config->systemMode == 'classic' and empty($executions)))) ? false : true;
if($printBtn and ($createStoryPriv or $createTaskPriv or $createBugPriv))
{
$isonlybody = isonlybody();
unset($_GET['onlybody']);
@@ -85,7 +86,7 @@
echo "<ul class='dropdown-menu pull-right' role='menu'>";
if($createStoryPriv) echo '<li>' . html::a('###', $lang->todo->reasonList['story'], '', "data-toggle='modal' data-target='#productModal' data-backdrop='false' data-moveable='true' data-position='center' id='toStoryLink'") . '</li>';
if($createTaskPriv) echo '<li>' . html::a('###', $lang->todo->reasonList['task'], '', "data-toggle='modal' data-target='#executionModal' data-backdrop='false' data-moveable='true' data-position='center' id='toTaskLink'") . '</li>';
if($createBugPriv) echo '<li>' . html::a('###', $lang->todo->reasonList['bug'], '', "data-toggle='modal' data-target='#projectProductModal' data-backdrop='false' data-moveable='true' data-position='center' id='toBugLink'") . '</li>';
if($createBugPriv and $config->vision == 'rnd') echo '<li>' . html::a('###', $lang->todo->reasonList['bug'], '', "data-toggle='modal' data-target='#projectProductModal' data-backdrop='false' data-moveable='true' data-position='center' id='toBugLink'") . '</li>';
echo "</ul>";
if($isonlybody) $_GET['onlybody'] = 'yes';
}