From 93247d33a7f17be8172e4d009b33561da1932f61 Mon Sep 17 00:00:00 2001 From: liugang Date: Tue, 11 Oct 2022 15:57:02 +0800 Subject: [PATCH] * Hide the link and unlink buttons if the execution is a none-product and single one. --- module/execution/view/story.html.php | 31 +++++++++++++++++++++++----- module/story/model.php | 2 +- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/module/execution/view/story.html.php b/module/execution/view/story.html.php index 8960abebac..e1f2bd7d83 100644 --- a/module/execution/view/story.html.php +++ b/module/execution/view/story.html.php @@ -78,6 +78,7 @@ id", " " . $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¶ms=$wizardParams"), " {$lang->execution->linkStory}",'', "class='btn btn-link link-story-btn'"); } - else + elseif($canLinkStory) // The none-product and single execution cann't link stories. { echo " createLink('execution', 'batchUnlinkStory', "executionID=$execution->id"); echo html::commonButton($lang->execution->unlinkStoryAB, "data-form-action='$actionLink'"); diff --git a/module/story/model.php b/module/story/model.php index aba40461bf..58dc081063 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -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) {