From 5a31b9d5c8c301c4d78285f7ef77f045ca80fc16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Nicolaysen=20S=C3=B8rnes?= Date: Mon, 17 Dec 2007 19:34:04 +0100 Subject: [PATCH] version: Change state when moving from queued to accepted application --- include/version.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/include/version.php b/include/version.php index ff8f056..025cd92 100644 --- a/include/version.php +++ b/include/version.php @@ -204,11 +204,16 @@ class version { if ($this->iAppId && ($this->iAppId!=$oVersion->iAppId)) { - if (!query_parameters("UPDATE appVersion SET appId = '?' WHERE versionId = '?'", - $this->iAppId, $this->iVersionId)) - return false; $oAppBefore = new Application($oVersion->iAppId); $oAppAfter = new Application($this->iAppId); + + if($oAppAfter->objectGetState() == 'accepted' && $this->sState == 'pending') + $this->sState = 'queued'; + + if (!query_parameters("UPDATE appVersion SET appId = '?', state = '?' WHERE versionId = '?'", + $this->iAppId, $this->sState, $this->iVersionId)) + return false; + $sWhatChanged .= "Version was moved from application ".$oAppBefore->sName." to application ".$oAppAfter->sName.".\n\n"; }