From 4ff65cf03194118b7f327bc16a28598758ef10a7 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Mon, 11 Apr 2022 13:18:41 +0800 Subject: [PATCH] * Fix bug#18072. --- module/testtask/control.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/module/testtask/control.php b/module/testtask/control.php index 557624257f..1b3f609a20 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -1085,7 +1085,14 @@ class testtask extends control $response['result'] = 'success'; $response['message'] = ''; - $testRun = $this->dao->select('task,`case`')->from(TABLE_TESTRUN)->where('id')->eq((int)$rowID)->fetch(); + $testRun = $this->dao->select('t1.task,t1.`case`,t2.story')->from(TABLE_TESTRUN)->alias('t1') + ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case=t2.id') + ->where('t1.id')->eq((int)$rowID) + ->fetch(); + + $linkedProject = $this->dao->select('project')->from(TABLE_PROJECTSTORY)->where('story')->eq($testRun->story)->fetchPairs('project'); + $this->dao->delete()->from(TABLE_PROJECTCASE)->where('`case`')->eq($testRun->case)->andWhere('project')->notin($linkedProject)->exec(); + $this->dao->delete()->from(TABLE_TESTRUN)->where('id')->eq((int)$rowID)->exec(); if(dao::isError()) {