Skip to content

Commit

Permalink
. # 0008588: Failed to delete the keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
fmancardi committed Mar 7, 2019
1 parent d28f915 commit ee7b552
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions lib/functions/testproject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ function deleteKeyword($id, $opt=null) {

if( $this->cfg->keywords->onDeleteCheckFrozenTCVersions ) {
$linkedToFrozen = $this->checkKeywordIsLinkedToFrozenVersions($id);
$doIt = $doIt && $linkedToFrozen;
$doIt = $doIt && !$linkedToFrozen;
}
}

Expand Down Expand Up @@ -2659,12 +2659,6 @@ function copy_as($id,$new_id,$user_id,$new_name=null,$options=null) {
$oldNewMappings['requirements'] =
$this->copy_requirements($id,$new_id,$user_id);

/*echo '<pre>';
var_dump($oldNewMappings['requirements']);
echo '</pre>';
die();
*/

// need to copy relations between requirements
$rel = null;
foreach ($oldNewMappings['requirements']['req'] as $okey => $nkey) {
Expand Down Expand Up @@ -3240,11 +3234,7 @@ function _get_subtree_rec($node_id,&$pnode,$filters = null, $options = null) {
}
}

// 2018
$ssx .= $kwJoin . $where;

//echo '<br>' . __LINE__ . '....' . __FILE__;
//echo '<br>' . $ssx; //die();
$highlander = $this->db->fetchRowsIntoMap($ssx,'tc_id');
if( $filterOnTC ) {
$ky = !is_null($highlander) ? array_diff_key($tclist,$highlander) : $tclist;
Expand Down Expand Up @@ -3932,6 +3922,7 @@ static function getAPIKey(&$dbh,$id) {
*/
function checkKeywordIsLinkedAndNotExecuted($keyword_id,$tproject_id=null) {

$debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__;
$wheraAdd = '';
$sql = " SELECT id,keyword FROM {$this->tables['keywords']} KW
WHERE id = {$keyword_id} ";
Expand All @@ -3948,7 +3939,8 @@ function checkKeywordIsLinkedAndNotExecuted($keyword_id,$tproject_id=null) {

// Now try to understand if it is linked
if( !is_null($rs) ) {
$sql = " SELECT DISTINCT keyword_id,keyword,
$sql = "/* $debugMsg */
SELECT DISTINCT keyword_id,keyword,
CASE
WHEN EX.status IS NULL THEN 'NOT_RUN'
ELSE 'EXECUTED'
Expand All @@ -3974,6 +3966,7 @@ function checkKeywordIsLinkedAndNotExecuted($keyword_id,$tproject_id=null) {
*/
function checkKeywordIsLinkedToFrozenVersions($keyword_id,$tproject_id=null) {

$debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__;
$wheraAdd = '';
$sql = " SELECT id,keyword FROM {$this->tables['keywords']} KW
WHERE id = {$keyword_id} ";
Expand All @@ -3989,7 +3982,8 @@ function checkKeywordIsLinkedToFrozenVersions($keyword_id,$tproject_id=null) {
}

if( !is_null($rs) ) {
$sql = " SELECT DISTINCT keyword_id,keyword,
$sql = "/* $debugMsg */
SELECT DISTINCT keyword_id,keyword,
CASE
WHEN TCV.is_open=0 THEN 'FROZEN'
ELSE 'FRESH'
Expand All @@ -4003,7 +3997,6 @@ function checkKeywordIsLinkedToFrozenVersions($keyword_id,$tproject_id=null) {
WHERE KW.id = {$keyword_id} {$whereAdd} ";
}
echo $sql;
$rs = $this->db->fetchRowsIntoMap($sql,'freeze_status');

$rs = (array)$rs;
Expand All @@ -4027,13 +4020,15 @@ function getKeywordSimple( $keyword_id ) {
*/
function getKeywordsExecStatus($keywordSet,$tproject_id=null) {

$debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__;
$wheraAdd = '';
if( null != $tproject_id ) {
$whereAdd = " AND testproject_id = " . intval($tproject_id);
}

$idSet = implode(',', $keywordSet);
$sql = " SELECT DISTINCT keyword_id,keyword,
$sql = "/* $debugMsg */
SELECT DISTINCT keyword_id,keyword,
CASE
WHEN EX.status IS NULL THEN 'NOT_RUN'
ELSE 'EXECUTED'
Expand All @@ -4057,13 +4052,15 @@ function getKeywordsExecStatus($keywordSet,$tproject_id=null) {
*/
function getKeywordsFreezeStatus($keywordSet,$tproject_id=null) {

$debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__;
$wheraAdd = '';
if( null != $tproject_id ) {
$whereAdd = " AND testproject_id = " . intval($tproject_id);
}

$idSet = implode(',', $keywordSet);
$sql = " SELECT DISTINCT keyword_id,keyword,
$sql = "/* $debugMsg */
SELECT DISTINCT keyword_id,keyword,
CASE
WHEN TCV.is_open=0 THEN 'FROZEN'
ELSE 'FRESH'
Expand Down

0 comments on commit ee7b552

Please sign in to comment.