From 694fc5d561531817ba21d2126757beef16f7aad7 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Sat, 7 May 2005 04:14:19 +0000 Subject: [PATCH] Delete the matching version submission when deleting an application submission. Otherwise we will orphan the version submission and it will remain queued but won't be visible because there is no application to link it to anymore. --- admin/adminAppQueue.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/admin/adminAppQueue.php b/admin/adminAppQueue.php index 7f04b29..c651b49 100644 --- a/admin/adminAppQueue.php +++ b/admin/adminAppQueue.php @@ -220,8 +220,22 @@ if ($_REQUEST['sub']) { if (is_numeric($_REQUEST['appId']) && !is_numeric($_REQUEST['versionId'])) // application { + // delete the application entry $oApp = new Application($_REQUEST['appId']); $oApp->delete(); + + // get the queued versions that refers to the application entry we just removed + // and delete them as we implicitly added a version entry when adding a new application + $sQuery = "SELECT versionId FROM appVersion WHERE appVersion.appId = '".$_REQUEST['appId']."' AND appVersion.queued = 'true';"; + $hResult = query_appdb($sQuery); + if($hResult) + { + while($oRow = mysql_fetch_object($hResult)) + { + $oVersion = new Version($oRow->versionId); + $oVersion->delete(); + } + } } else if(is_numeric($_REQUEST['versionId'])) // version { $oVersion = new Version($_REQUEST['versionId']);