From c9fe3ad05002383076ef64b155209db3518429a8 Mon Sep 17 00:00:00 2001 From: atisne Date: Thu, 12 Feb 2026 14:59:12 +0100 Subject: [PATCH] #0009393: Delete a Test Case version with a platform fails Adding the deletion of the linked platform to avoid foreign key violation. --- lib/functions/testcase.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/functions/testcase.class.php b/lib/functions/testcase.class.php index 06818dcf0e..a5dad5830e 100644 --- a/lib/functions/testcase.class.php +++ b/lib/functions/testcase.class.php @@ -1726,7 +1726,7 @@ function get_linked_versions($id,$filters=null,$options=null) tcversions nodes from hierarchy testcase_script_links - + platforms */ function _blind_delete($id,$version_id=self::ALL_VERSIONS,$children=null) { $debugMsg = 'Class:' . __CLASS__ . ' - Method: ' . __FUNCTION__; @@ -1781,12 +1781,16 @@ function _blind_delete($id,$version_id=self::ALL_VERSIONS,$children=null) { WHERE testcase_id = {$id} AND tcversion_id IN ({$tcversion_list})"; + $sql[]="/* $debugMsg */ + DELETE FROM {$this->tables['testcase_platforms']} + WHERE testcase_id = {$id} + AND tcversion_id IN ({$tcversion_list})"; + $sql[]="/* $debugMsg */ DELETE FROM {$this->tables['req_coverage']} WHERE testcase_id = {$id} AND tcversion_id IN ({$tcversion_list})"; - // This has to be the last, to avoid FK issues $sql[]="/* $debugMsg */ DELETE FROM {$this->tables['tcversions']}