* Hide the link and unlink buttons if the execution is a none-product and single one.

This commit is contained in:
liugang
2022-10-11 15:57:02 +08:00
parent a8ffa986c0
commit 657b36b3dc
2 changed files with 27 additions and 6 deletions
+26 -5
View File
@@ -78,6 +78,7 @@
<?php
common::printLink('story', 'export', "productID=$productID&orderBy=id_desc&executionID=$execution->id", "<i class='icon icon-export muted'></i> " . $lang->story->export, '', "class='btn btn-link export iframe'");
$canLinkStory = $execution->hasProduct or $execution->multiple;
if(common::canModify('execution', $execution))
{
$this->lang->story->create = $this->lang->execution->createStory;
@@ -122,7 +123,7 @@
$wizardParams = helper::safe64Encode("execution=$execution->id");
echo html::a($this->createLink('tutorial', 'wizard', "module=execution&method=linkStory&params=$wizardParams"), "<i class='icon-link'></i> {$lang->execution->linkStory}",'', "class='btn btn-link link-story-btn'");
}
else
elseif($canLinkStory) // The none-product and single execution cann't link stories.
{
echo "<div class='btn-group dropdown'>";
@@ -184,9 +185,29 @@
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->story->noStory;?></span>
<?php if(common::canModify('execution', $execution) and common::hasPriv('execution', 'linkStory')):?>
<?php echo html::a($this->createLink('execution', 'linkStory', "execution=$execution->id"), "<i class='icon icon-link'></i> " . $lang->execution->linkStory, '', "class='btn btn-info'");?>
<?php endif;?>
<?php
if(common::canModify('execution', $execution))
{
if($canLinkStory && common::hasPriv('execution', 'linkStory'))
{
echo html::a($this->createLink('execution', 'linkStory', "execution=$execution->id"), "<i class='icon icon-link'></i> " . $lang->execution->linkStory, '', "class='btn btn-info'");
}
else
{
$storyModuleID = (int)$this->cookie->storyModuleParam;
if(common::hasPriv('story', 'create'))
{
$createStoryLink = $this->createLink('story', 'create', "productID=$productID&branch=0&moduleID={$storyModuleID}&story=0&execution=$execution->id");
echo html::a($createStoryLink, "<i class='icon icon-plus'></i> " . $lang->execution->createStory, '', "class='btn btn-info' data-app=$app->tab");
}
elseif(common::hasPriv('story', 'batchCreate'))
{
$batchCreateLink = $this->createLink('story', 'batchCreate', "productID=$productID&branch=0&moduleID={$storyModuleID}&story=0&execution=$execution->id");
echo html::a($batchCreateLink, "<i class='icon icon-plus'></i> " . $lang->story->batchCreate, '', "class='btn btn-info' data-app=$app->tab");
}
}
}
?>
</p>
</div>
<?php else:?>
@@ -289,7 +310,7 @@
</div>
<?php endif;?>
<?php
if(common::hasPriv('execution', 'batchUnlinkStory'))
if($canLinkStory && common::hasPriv('execution', 'batchUnlinkStory'))
{
$actionLink = $this->createLink('execution', 'batchUnlinkStory', "executionID=$execution->id");
echo html::commonButton($lang->execution->unlinkStoryAB, "data-form-action='$actionLink'");
+1 -1
View File
@@ -4415,7 +4415,7 @@ class storyModel extends model
$canBatchCreateTask = common::hasPriv('task', 'batchCreate');
$canCreateCase = ($hasDBPriv and common::hasPriv('testcase', 'create'));
$canEstimate = common::hasPriv('execution', 'storyEstimate', $execution);
$canUnlinkStory = common::hasPriv('execution', 'unlinkStory', $execution);
$canUnlinkStory = (common::hasPriv('execution', 'unlinkStory', $execution) and ($execution->hasProduct or $execution->multiple));
if(strpos('draft,changing', $story->status) !== false)
{