From 4d82c32adc0e3a661f85eedfd01e8e355f896aa5 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Fri, 24 Aug 2007 03:49:33 +0000 Subject: [PATCH] Enable deletion of a distribution's test results along with the distribution, if the user has admin privileges. --- include/distribution.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/include/distribution.php b/include/distribution.php index 3c49062..a905682 100644 --- a/include/distribution.php +++ b/include/distribution.php @@ -151,11 +151,16 @@ class distribution { $this->sQueued != "false"))) return false; - /* Check for associated test results */ - if(sizeof($this->aTestingIds)) + // if the distribution has test results only enable an admin to delete + // the distribution + if(sizeof($this->aTestingIds) && !$_SESSION['current']->hasPriv("admin")) + return FALSE; + + // delete any test results this distribution has + foreach($this->aTestingIds as $iTestId) { - addmsg("This distribution still has associated test results", "red"); - return FALSE; + $oTestData = new TestData($iTestId); + $oTestData->delete(); } // now delete the Distribution