*Finish task #8194.
This commit is contained in:
+13
-10
@@ -2509,14 +2509,14 @@ class bugModel extends model
|
||||
/* Check the product is closed. */
|
||||
$changeAllowed = common::checkObjectChangeAllowed('bug', $bug);
|
||||
|
||||
$canBatchEdit = common::hasPriv('bug', 'batchEdit');
|
||||
$canBatchConfirm = common::hasPriv('bug', 'batchConfirm');
|
||||
$canBatchEdit = ($changeAllowed and common::hasPriv('bug', 'batchEdit'));
|
||||
$canBatchConfirm = ($changeAllowed and common::hasPriv('bug', 'batchConfirm'));
|
||||
$canBatchClose = common::hasPriv('bug', 'batchClose');
|
||||
$canBatchActivate = common::hasPriv('bug', 'batchActivate');
|
||||
$canBatchChangeBranch = common::hasPriv('bug', 'batchChangeBranch');
|
||||
$canBatchChangeModule = common::hasPriv('bug', 'batchChangeModule');
|
||||
$canBatchResolve = common::hasPriv('bug', 'batchResolve');
|
||||
$canBatchAssignTo = common::hasPriv('bug', 'batchAssignTo');
|
||||
$canBatchActivate = ($changeAllowed and common::hasPriv('bug', 'batchActivate'));
|
||||
$canBatchChangeBranch = ($changeAllowed and common::hasPriv('bug', 'batchChangeBranch'));
|
||||
$canBatchChangeModule = ($changeAllowed and common::hasPriv('bug', 'batchChangeModule'));
|
||||
$canBatchResolve = ($changeAllowed and common::hasPriv('bug', 'batchResolve'));
|
||||
$canBatchAssignTo = ($changeAllowed and common::hasPriv('bug', 'batchAssignTo'));
|
||||
|
||||
$canBatchAction = ($canBatchEdit or $canBatchConfirm or $canBatchClose or $canBatchActivate or $canBatchChangeBranch or $canBatchChangeModule or $canBatchResolve or $canBatchAssignTo);
|
||||
|
||||
@@ -2578,8 +2578,7 @@ class bugModel extends model
|
||||
case 'id':
|
||||
if($canBatchAction)
|
||||
{
|
||||
$disabled = $changeAllowed ? '' : 'disabled';
|
||||
echo html::checkbox('bugIDList', array($bug->id => ''), '', $disabled) . html::a(helper::createLink('bug', 'view', "bugID=$bug->id"), sprintf('%03d', $bug->id));
|
||||
echo html::checkbox('bugIDList', array($bug->id => ''), '') . html::a(helper::createLink('bug', 'view', "bugID=$bug->id"), sprintf('%03d', $bug->id));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2730,15 +2729,19 @@ class bugModel extends model
|
||||
echo substr($bug->lastEditedDate, 5, 11);
|
||||
break;
|
||||
case 'actions':
|
||||
$params = "bugID=$bug->id";
|
||||
if($changeAllowed)
|
||||
{
|
||||
$params = "bugID=$bug->id";
|
||||
common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'confirm', '', 'iframe', true);
|
||||
common::printIcon('bug', 'resolve', $params, $bug, 'list', 'checked', '', 'iframe', true);
|
||||
common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true);
|
||||
common::printIcon('bug', 'edit', $params, $bug, 'list');
|
||||
common::printIcon('bug', 'create', "product=$bug->product&branch=$bug->branch&extra=$params", $bug, 'list', 'copy');
|
||||
}
|
||||
else
|
||||
{
|
||||
common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
@@ -211,14 +211,15 @@ $currentBrowseType = isset($lang->bug->mySelects[$browseType]) && in_array($brow
|
||||
$widths = $this->datatable->setFixedFieldWidth($setting);
|
||||
$columns = 0;
|
||||
|
||||
$canBatchEdit = common::hasPriv('bug', 'batchEdit');
|
||||
$canBatchConfirm = common::hasPriv('bug', 'batchConfirm');
|
||||
$changeAllowed = (empty($config->global->closedProductStatus) or $product->status != 'closed');
|
||||
$canBatchEdit = ($changeAllowed and common::hasPriv('bug', 'batchEdit'));
|
||||
$canBatchConfirm = ($changeAllowed and common::hasPriv('bug', 'batchConfirm'));
|
||||
$canBatchClose = common::hasPriv('bug', 'batchClose');
|
||||
$canBatchActivate = common::hasPriv('bug', 'batchActivate');
|
||||
$canBatchChangeBranch = common::hasPriv('bug', 'batchChangeBranch');
|
||||
$canBatchChangeModule = common::hasPriv('bug', 'batchChangeModule');
|
||||
$canBatchResolve = common::hasPriv('bug', 'batchResolve');
|
||||
$canBatchAssignTo = common::hasPriv('bug', 'batchAssignTo');
|
||||
$canBatchActivate = ($changeAllowed and common::hasPriv('bug', 'batchActivate'));
|
||||
$canBatchChangeBranch = ($changeAllowed and common::hasPriv('bug', 'batchChangeBranch'));
|
||||
$canBatchChangeModule = ($changeAllowed and common::hasPriv('bug', 'batchChangeModule'));
|
||||
$canBatchResolve = ($changeAllowed and common::hasPriv('bug', 'batchResolve'));
|
||||
$canBatchAssignTo = ($changeAllowed and common::hasPriv('bug', 'batchAssignTo'));
|
||||
|
||||
$canBatchAction = ($canBatchEdit or $canBatchConfirm or $canBatchClose or $canBatchActivate or $canBatchChangeBranch or $canBatchChangeModule or $canBatchResolve or $canBatchAssignTo);
|
||||
?>
|
||||
|
||||
+5
-19
@@ -1490,7 +1490,7 @@ EOD;
|
||||
global $app, $lang;
|
||||
|
||||
/* Check the parent object is closed. */
|
||||
if(!commonModel::checkObjectChangeAllowed($module, $object)) return false;
|
||||
if(strpos('close|batchClose', $method) === false and !commonModel::checkObjectChangeAllowed($module, $object)) return false;
|
||||
|
||||
/* Check is the super admin or not. */
|
||||
if(!empty($app->user->admin) || strpos($app->company->admins, ",{$app->user->account},") !== false) return true;
|
||||
@@ -1855,32 +1855,18 @@ EOD;
|
||||
global $app, $config;
|
||||
|
||||
/* Check the product is closed. */
|
||||
if(!empty($object->product) and !empty($config->global->closedProductStatus))
|
||||
if(!empty($object->product) and is_numeric($object->product) and !empty($config->global->closedProductStatus))
|
||||
{
|
||||
$productID = trim($object->product, ',');
|
||||
$product = $app->control->loadModel('product')->getByID($productID);
|
||||
if($product->status == 'closed') return false;
|
||||
|
||||
/* Get the projects associated with the story. */
|
||||
if($module == 'story' and empty($object->project))
|
||||
{
|
||||
$projects = $app->dbh->query('SELECT project FROM ' . TABLE_PROJECTSTORY . " WHERE `story` = '$object->id'")->fetchAll();
|
||||
$projectIDList = array();
|
||||
foreach($projects as $project) $projectIDList[] = $project->project;
|
||||
|
||||
$object->project = implode(',', $projectIDList);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check the project is closed. */
|
||||
if(!empty($object->project) and !empty($config->global->closedProjectStatus))
|
||||
if(strpos('story|bug|testtask', $module) === false and !empty($object->project) and is_numeric($object->project) and !empty($config->global->closedProjectStatus))
|
||||
{
|
||||
$projectIDList = explode(',', $object->project);
|
||||
$projects = $app->control->loadModel('project')->getByIDList($projectIDList);
|
||||
foreach($projects as $project)
|
||||
{
|
||||
if($project->status == 'closed') return false;
|
||||
}
|
||||
$project = $app->control->loadModel('project')->getByID($object->project);
|
||||
if($project->status == 'closed') return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -189,14 +189,15 @@ js::set('foldAll', $lang->project->treeLevel['root']);
|
||||
$widths = $this->datatable->setFixedFieldWidth($setting);
|
||||
$columns = 0;
|
||||
|
||||
$canBatchEdit = common::hasPriv('story', 'batchEdit');
|
||||
$canBatchClose = common::hasPriv('story', 'batchClose') and strtolower($browseType) != 'closedbyme' and strtolower($browseType) != 'closedstory';
|
||||
$canBatchReview = common::hasPriv('story', 'batchReview');
|
||||
$canBatchChangeStage = common::hasPriv('story', 'batchChangeStage');
|
||||
$canBatchChangeBranch = common::hasPriv('story', 'batchChangeBranch');
|
||||
$canBatchChangeModule = common::hasPriv('story', 'batchChangeModule');
|
||||
$canBatchChangePlan = common::hasPriv('story', 'batchChangePlan');
|
||||
$canBatchAssignTo = common::hasPriv('story', 'batchAssignTo');
|
||||
$changeAllowed = (empty($config->global->closedProductStatus) or $product->status != 'closed');
|
||||
$canBatchEdit = ($changeAllowed and common::hasPriv('story', 'batchEdit'));
|
||||
$canBatchClose = (common::hasPriv('story', 'batchClose') and strtolower($browseType) != 'closedbyme' and strtolower($browseType) != 'closedstory');
|
||||
$canBatchReview = ($changeAllowed and common::hasPriv('story', 'batchReview'));
|
||||
$canBatchChangeStage = ($changeAllowed and common::hasPriv('story', 'batchChangeStage'));
|
||||
$canBatchChangeBranch = ($changeAllowed and common::hasPriv('story', 'batchChangeBranch'));
|
||||
$canBatchChangeModule = ($changeAllowed and common::hasPriv('story', 'batchChangeModule'));
|
||||
$canBatchChangePlan = ($changeAllowed and common::hasPriv('story', 'batchChangePlan'));
|
||||
$canBatchAssignTo = ($changeAllowed and common::hasPriv('story', 'batchAssignTo'));
|
||||
|
||||
$canBatchAction = ($canBatchEdit or $canBatchClose or $canBatchReview or $canBatchChangeStage or $canBatchChangeModule or $canBatchChangePlan or $canBatchAssignTo);
|
||||
?>
|
||||
|
||||
+39
-29
@@ -696,6 +696,10 @@ class project extends control
|
||||
$project = $this->commonAction($projectID);
|
||||
$projectID = $project->id;
|
||||
|
||||
/* Determines whether an object is editable. */
|
||||
$changeAllowed = true;
|
||||
if(!empty($this->config->global->closedProjectStatus) and $project->status == 'closed') $changeAllowed = false;
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
@@ -756,24 +760,25 @@ class project extends control
|
||||
if($productPairs) $productID = key($productPairs);
|
||||
|
||||
/* Assign. */
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->project = $project;
|
||||
$this->view->stories = $stories;
|
||||
$this->view->allPlans = $allPlans;
|
||||
$this->view->summary = $this->product->summary($stories);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->type = $this->session->projectStoryBrowseType;
|
||||
$this->view->param = $param;
|
||||
$this->view->moduleTree = $this->loadModel('tree')->getProjectStoryTreeMenu($projectID, $startModuleID = 0, array('treeModel', 'createProjectStoryLink'));
|
||||
$this->view->tabID = 'story';
|
||||
$this->view->storyTasks = $storyTasks;
|
||||
$this->view->storyBugs = $storyBugs;
|
||||
$this->view->storyCases = $storyCases;
|
||||
$this->view->users = $users;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->branchGroups = $branchGroups;
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->project = $project;
|
||||
$this->view->stories = $stories;
|
||||
$this->view->allPlans = $allPlans;
|
||||
$this->view->summary = $this->product->summary($stories);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->type = $this->session->projectStoryBrowseType;
|
||||
$this->view->param = $param;
|
||||
$this->view->moduleTree = $this->loadModel('tree')->getProjectStoryTreeMenu($projectID, $startModuleID = 0, array('treeModel', 'createProjectStoryLink'));
|
||||
$this->view->tabID = 'story';
|
||||
$this->view->storyTasks = $storyTasks;
|
||||
$this->view->storyBugs = $storyBugs;
|
||||
$this->view->storyCases = $storyCases;
|
||||
$this->view->users = $users;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->branchGroups = $branchGroups;
|
||||
$this->view->changeAllowed = $changeAllowed;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -933,6 +938,10 @@ class project extends control
|
||||
$project = $this->commonAction($projectID);
|
||||
$projectID = $project->id;
|
||||
|
||||
/* Determines whether an object is editable. */
|
||||
$changeAllowed = true;
|
||||
if(!empty($this->config->global->closedProjectStatus) and $project->status == 'closed') $changeAllowed = false;
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = pager::init($recTotal, $recPerPage, $pageID);
|
||||
@@ -942,17 +951,18 @@ class project extends control
|
||||
$tasks = $this->testtask->getProjectTasks($projectID, $orderBy, $pager);
|
||||
foreach($tasks as $key => $task) $productTasks[$task->product][] = $task;
|
||||
|
||||
$this->view->title = $this->projects[$projectID] . $this->lang->colon . $this->lang->testtask->common;
|
||||
$this->view->position[] = html::a($this->createLink('project', 'testtask', "projectID=$projectID"), $this->projects[$projectID]);
|
||||
$this->view->position[] = $this->lang->testtask->common;
|
||||
$this->view->project = $project;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->projectName = $this->projects[$projectID];
|
||||
$this->view->pager = $pager;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->tasks = $productTasks;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
|
||||
$this->view->products = $this->loadModel('product')->getPairs();
|
||||
$this->view->title = $this->projects[$projectID] . $this->lang->colon . $this->lang->testtask->common;
|
||||
$this->view->position[] = html::a($this->createLink('project', 'testtask', "projectID=$projectID"), $this->projects[$projectID]);
|
||||
$this->view->position[] = $this->lang->testtask->common;
|
||||
$this->view->project = $project;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->projectName = $this->projects[$projectID];
|
||||
$this->view->pager = $pager;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->tasks = $productTasks;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
|
||||
$this->view->products = $this->loadModel('product')->getPairs();
|
||||
$this->view->changeAllowed = $changeAllowed;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
$canBatchUnlink = common::hasPriv('project', 'batchUnlinkStory');
|
||||
$canBatchToTask = common::hasPriv('story', 'batchToTask');
|
||||
|
||||
$canBatchAction = ($canBatchEdit or $canBatchClose or $canBatchChangeStage or $canBatchUnlink or $canBatchToTask);
|
||||
$canBatchAction = ($changeAllowed and ($canBatchEdit or $canBatchClose or $canBatchChangeStage or $canBatchUnlink or $canBatchToTask));
|
||||
?>
|
||||
<?php $vars = "projectID={$project->id}&orderBy=%s&type=$type¶m=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
|
||||
<th class='c-id {sorter:false}'>
|
||||
@@ -149,16 +149,13 @@
|
||||
<tbody id='storyTableList' class='sortable'>
|
||||
<?php foreach($stories as $key => $story):?>
|
||||
<?php
|
||||
$changeAllowed = common::checkObjectChangeAllowed('story', $story);
|
||||
$disabled = $changeAllowed ? '' : 'disabled';
|
||||
|
||||
$storyLink = $this->createLink('story', 'view', "storyID=$story->id&version=$story->version&from=project¶m=$project->id");
|
||||
$totalEstimate += $story->estimate;
|
||||
?>
|
||||
<tr id="story<?php echo $story->id;?>" data-id='<?php echo $story->id;?>' data-order='<?php echo $story->order ?>' data-estimate='<?php echo $story->estimate?>' data-cases='<?php echo zget($storyCases, $story->id, 0)?>'>
|
||||
<td class='cell-id'>
|
||||
<?php if($canBatchAction):?>
|
||||
<?php echo html::checkbox('storyIdList', array($story->id => ''), '', $disabled) . html::a(helper::createLink('story', 'view', "storyID=$story->id"), sprintf('%03d', $story->id));?>
|
||||
<?php echo html::checkbox('storyIdList', array($story->id => '')) . html::a(helper::createLink('story', 'view', "storyID=$story->id"), sprintf('%03d', $story->id));?>
|
||||
<?php else:?>
|
||||
<?php printf('%03d', $story->id);?>
|
||||
<?php endif;?>
|
||||
@@ -199,9 +196,9 @@
|
||||
</td>
|
||||
<td class='c-actions'>
|
||||
<?php
|
||||
$hasDBPriv = common::hasDBPriv($project, 'project');
|
||||
if($changeAllowed)
|
||||
{
|
||||
$hasDBPriv = common::hasDBPriv($project, 'project');
|
||||
$param = "projectID={$project->id}&story={$story->id}&moduleID={$story->module}";
|
||||
|
||||
$lang->task->create = $lang->project->wbs;
|
||||
@@ -221,7 +218,7 @@
|
||||
$lang->testcase->batchCreate = $lang->testcase->create;
|
||||
if($productID && $hasDBPriv) common::printIcon('testcase', 'batchCreate', "productID=$story->product&branch=$story->branch&moduleID=$story->module&storyID=$story->id", '', 'list', 'sitemap');
|
||||
|
||||
if(common::hasPriv('project', 'unlinkStory', $project))
|
||||
if($changeAllowed and common::hasPriv('project', 'unlinkStory', $project))
|
||||
{
|
||||
$unlinkURL = $this->createLink('project', 'unlinkStory', "projectID=$project->id&storyID=$story->id&confirm=yes");
|
||||
echo html::a("javascript:ajaxDelete(\"$unlinkURL\", \"storyList\", confirmUnlinkStory)", '<i class="icon-unlink"></i>', '', "class='btn' title='{$lang->project->unlinkStory}'");
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<table class="table table-grouped has-sort-head" id='taskList'>
|
||||
<thead>
|
||||
<?php $vars = "projectID=$projectID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
|
||||
<?php $canTestReport = common::hasPriv('testreport', 'browse');?>
|
||||
<?php $canTestReport = ($changeAllowed and common::hasPriv('testreport', 'browse'));?>
|
||||
<tr class='<?php if($total) echo 'divider'; ?>'>
|
||||
<th class='c-side text-center'><?php common::printOrderLink('product', $orderBy, $vars, $lang->testtask->product);?></th>
|
||||
<th class="c-id">
|
||||
@@ -73,10 +73,6 @@
|
||||
<?php foreach($tasks as $product => $productTasks):?>
|
||||
<?php $productName = zget($products, $product, '');?>
|
||||
<?php foreach($productTasks as $task):?>
|
||||
<?php
|
||||
$changeAllowed = common::checkObjectChangeAllowed('task', $task);
|
||||
$disabled = $changeAllowed ? '' : 'disabled';
|
||||
?>
|
||||
<tr data-id='<?php echo $product;?>' <?php if($task == reset($productTasks)) echo "class='divider-top'";?>>
|
||||
<?php if($task == reset($productTasks)):?>
|
||||
<td rowspan='<?php echo count($productTasks);?>' class='c-side text-left group-toggle'>
|
||||
@@ -86,7 +82,7 @@
|
||||
<?php endif;?>
|
||||
<td class="c-id">
|
||||
<?php if($canTestReport):?>
|
||||
<?php echo html::checkbox('taskIdList', array($task->id => sprintf('%03d', $task->id)), '', $disabled);?>
|
||||
<?php echo html::checkbox('taskIdList', array($task->id => sprintf('%03d', $task->id)));?>
|
||||
<?php else:?>
|
||||
<?php printf('%03d', $task->id);?>
|
||||
<?php endif;?>
|
||||
|
||||
@@ -3094,8 +3094,7 @@ class storyModel extends model
|
||||
case 'id':
|
||||
if($canBatchAction)
|
||||
{
|
||||
$disabled = $changeAllowed ? '' : 'disabled';
|
||||
echo html::checkbox('storyIdList', array($story->id => ''), '', $disabled) . html::a(helper::createLink('story', 'view', "storyID=$story->id"), sprintf('%03d', $story->id));
|
||||
echo html::checkbox('storyIdList', array($story->id => ''), '') . html::a(helper::createLink('story', 'view', "storyID=$story->id"), sprintf('%03d', $story->id));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3216,9 +3215,9 @@ class storyModel extends model
|
||||
echo $story->version;
|
||||
break;
|
||||
case 'actions':
|
||||
$vars = "story={$story->id}";
|
||||
if($changeAllowed)
|
||||
{
|
||||
$vars = "story={$story->id}";
|
||||
common::printIcon('story', 'change', $vars, $story, 'list', 'fork');
|
||||
common::printIcon('story', 'review', $vars, $story, 'list', 'glasses');
|
||||
common::printIcon('story', 'close', $vars, $story, 'list', '', '', 'iframe', true);
|
||||
@@ -3226,6 +3225,10 @@ class storyModel extends model
|
||||
if($this->config->global->flow != 'onlyStory') common::printIcon('story', 'createCase', "productID=$story->product&branch=$story->branch&module=0&from=¶m=0&$vars", $story, 'list', 'sitemap');
|
||||
common::printIcon('story', 'batchCreate', "productID=$story->product&branch=$story->branch&module=0&storyID=$story->id", $story, 'list', 'treemap-alt', '', '', '', '', $this->lang->story->subdivide);
|
||||
}
|
||||
else
|
||||
{
|
||||
common::printIcon('story', 'close', $vars, $story, 'list', '', '', 'iframe', true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
Reference in New Issue
Block a user