Skip to content

Commit

Permalink
fix: crash when trying to add req link to a test case that has latest…
Browse files Browse the repository at this point in the history
… version INACTIVE
  • Loading branch information
fmancardi committed May 9, 2020
1 parent eff2809 commit b798b66
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
11 changes: 7 additions & 4 deletions gui/templates/tl-classic/testcases/tcView_viewer.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,16 @@ viewer for test case in test specification
{if $gui->requirementsEnabled == TRUE &&
($gui->view_req_rights == "yes" || $gui->req_tcase_link_management) }
{$reqLinkingEnabled = 0}
{if $gui->req_tcase_link_management && $args_frozen_version=="no" &&
$edit_enabled == 1 }
{if $gui->req_tcase_link_management
&& $args_frozen_version == "no"
&& $args_testcase.active == 1
&& $edit_enabled == 1 }
{$reqLinkingEnabled = 1}
{/if}

{if $tlCfg->testcase_cfg->reqLinkingDisabledAfterExec == 1 &&
$has_been_executed == 1 && $args_tcase_cfg->can_edit_executed == 0}
{if $tlCfg->testcase_cfg->reqLinkingDisabledAfterExec == 1
&& $has_been_executed == 1
&& $args_tcase_cfg->can_edit_executed == 0}
{$reqLinkingEnabled = 0}
{/if}
<div {$addInfoDivStyle}>
Expand Down
16 changes: 10 additions & 6 deletions lib/functions/requirement_mgr.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1104,8 +1104,16 @@ function assign_to_tcase($req_id,$testcase_id,$author_id) {

$output = 0;
$now = $this->db->db_now();
if($testcase_id && $req_id) {
if ($testcase_id && $req_id) {
// Get Latest Active Test Case Version
$tcv = current($tcMgr->get_last_active_version($testcase_id));
if ($tcv == null) {
return $output;
}
}

// Go ahead
if ($testcase_id && $req_id) {
// Need to get latest version for each requirement
$reqIDSet = (array)$req_id;
$gopt = array('output' => 'id,version');
Expand All @@ -1118,8 +1126,6 @@ function assign_to_tcase($req_id,$testcase_id,$author_id) {
$reqLatestVersionNumberSet[] = $isofix['version'];
}

// Get Latest Active Test Case Version
$tcv = current($tcMgr->get_last_active_version($testcase_id));
$ltcv = $tcv['tcversion_id'];
$ltcvNum = $tcv['version'];
$in_clause = implode(",",$reqLatestVersionIDSet);
Expand Down Expand Up @@ -1161,9 +1167,7 @@ function assign_to_tcase($req_id,$testcase_id,$author_id) {
"ASSIGN",$this->object_table);
}
}
}
else
{
} else {
$output = 1;
}
}
Expand Down

0 comments on commit b798b66

Please sign in to comment.