Cleanup deletion and rejection code

This commit is contained in:
Tony Lambregts
2006-02-20 02:53:23 +00:00
committed by WineHQ
parent 602d15cdca
commit 385a7c2e0d

View File

@@ -177,73 +177,38 @@ if ($_REQUEST['sub'])
if (($_REQUEST['apptype'] == "application") && is_numeric($_REQUEST['appId'])) // application if (($_REQUEST['apptype'] == "application") && is_numeric($_REQUEST['appId'])) // application
{ {
// 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();
}
}
// delete the application entry // delete the application entry
$oApp = new Application($_REQUEST['appId']); $oApp = new Application($_REQUEST['appId']);
$oApp->delete(); $oApp->delete();
} else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version } else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version
{ {
// delete the Version entry
$oVersion = new Version($_REQUEST['versionId']); $oVersion = new Version($_REQUEST['versionId']);
$oVersion->delete(); $oVersion->delete();
} }
foreach($oVersion->aVersionIds as $iTestingId)
{
$oTest = new Version($iTestingId);
$oTest->delete();
}
redirect(apidb_fullurl("admin/adminAppQueue.php")); redirect(apidb_fullurl("admin/adminAppQueue.php"));
} }
else if ($_REQUEST['sub'] == 'Reject') else if ($_REQUEST['sub'] == 'Reject')
{ {
if (($_REQUEST['apptype'] == "application") && is_numeric($_REQUEST['appId'])) // application $oVersion = new Version($_REQUEST['versionId']);
$oTest = new testData($_REQUEST['iTestingId']);
$oVersion->GetOutputEditorValues();
$oTest->GetOutputEditorValues();
if ($_REQUEST['apptype'] == "application") // application
{ {
// 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->reject(true);
}
}
// delete the application entry
$oApp = new Application($_REQUEST['appId']); $oApp = new Application($_REQUEST['appId']);
$oApp->GetOutputEditorValues(); // load the values from $_REQUEST
$oApp->update(true);
$oApp->reject(); $oApp->reject();
} else if(($_REQUEST['apptype'] == "version") && is_numeric($_REQUEST['versionId'])) // version
{
$oVersion = new Version($_REQUEST['versionId']);
$oVersion->reject();
} }
foreach($oVersion->aVersionIds as $iTestingId) $oVersion->update(true);
{ $oVersion->reject();
$oTest = new Version($iTestingId); $oTest->update(true);
$oTest->GetOutputEditorValues(); $oTest->reject();
$oTest->iVersionId = $oVersion->iVersionId; redirect($_SERVER['PHP_SELF']);
$oTest->Update();
$oTest->reject();
}
redirect(apidb_fullurl("admin/adminAppQueue.php"));
} }
//process according to sub flag //process according to sub flag