diff --git a/admin/deleteAny.php b/admin/deleteAny.php index 70436ea..396ae1f 100644 --- a/admin/deleteAny.php +++ b/admin/deleteAny.php @@ -7,10 +7,12 @@ * application environment */ include("path.php"); -include(BASE."include/incl.php"); -include(BASE."include/category.php"); -include(BASE."include/application.php"); -include(BASE."include/mail.php"); +require_once(BASE."include/incl.php"); +require_once(BASE."include/category.php"); +require_once(BASE."include/application.php"); +require_once(BASE."include/mail.php"); +require_once(BASE."include/monitor.php"); + if($_REQUEST['confirmed'] != "yes") { diff --git a/include/monitor.php b/include/monitor.php index 6feb5bf..a1ffa44 100644 --- a/include/monitor.php +++ b/include/monitor.php @@ -23,7 +23,7 @@ class Monitor { { $sQuery = "SELECT * FROM appMonitors - WHERE MonitorId = '".$iMonitorId."'"; + WHERE monitorId = '".$iMonitorId."'"; $hResult = query_appdb($sQuery); $oRow = mysql_fetch_object($hResult); $this->iMonitorId = $oRow->monitorId; @@ -85,7 +85,7 @@ class Monitor { */ function delete($bSilent=false) { - $hResult = query_appdb("DELETE FROM appMonitors WHERE MonitorId = '".$this->iMonitorId."'"); + $hResult = query_appdb("DELETE FROM appMonitors WHERE monitorId = '".$this->iMonitorId."'"); if(!$bSilent) $this->SendNotificationMail("delete"); } diff --git a/include/version.php b/include/version.php index 3c063d1..6979828 100644 --- a/include/version.php +++ b/include/version.php @@ -8,7 +8,6 @@ require_once(BASE."include/comment.php"); require_once(BASE."include/url.php"); require_once(BASE."include/screenshot.php"); require_once(BASE."include/bugs.php"); -//require_once(BASE."include/testResults.php"); /** * Version class for handling versions. @@ -29,7 +28,8 @@ class Version { var $aScreenshotsIds; // an array that contains the screenshotId of every screenshot linked to this version var $aUrlsIds; // an array that contains the screenshotId of every url linked to this version var $aBuglinkIds; // an array that contains the buglinkId of every bug linked to this version - var $aTestingIds; // an array that contains the buglinkId of every bug linked to this version + var $aTestingIds; // an array that contains the testingId of every test result linked to this version + var $aMonitorIds; // an array that contains the monitorId of every monitor linked to this version /** * constructor, fetches the data. @@ -134,7 +134,7 @@ class Version { } /* - * We fetch Test ResultsIds. + * We fetch Test Results Ids. */ $this->aTestingIds = array(); $sQuery = "SELECT * @@ -145,7 +145,22 @@ class Version { { while($oRow = mysql_fetch_object($hResult)) { - $this->aTestingIds[] = $oRow->linkId; + $this->aTestingIds[] = $oRow->testingId; + } + } + /* + * We fetch monitor Ids. + */ + $this->aTestingIds = array(); + $sQuery = "SELECT * + FROM appMonitors + WHERE versionId = ".$iVersionId." + ORDER BY monitorId"; + if($hResult = query_appdb($sQuery)) + { + while($oRow = mysql_fetch_object($hResult)) + { + $this->aMonitorIds[] = $oRow->monitorId; } } } @@ -297,6 +312,16 @@ class Version { $oBug = new bug($iBug_id); $oBug->delete($bSilent); } + foreach($this->aTestingIds as $iTestId) + { + $oTest = new testData($iTestId); + $oTest->delete($bSilent); + } + foreach($this->aMonitorIds as $iMonitorId) + { + $oMonitor = new Monitor($iMonitorId); + $oMonitor->delete($bSilent); + } // remove any maintainers for this version so we don't orphan them $sQuery = "DELETE from appMaintainers WHERE versionId='".$this->iVersionId."';";