From 8be4e24864a190c5885f8d730fba1c07a9d3e37c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Nicolaysen=20S=C3=B8rnes?= Date: Thu, 23 Jul 2009 15:33:47 +0200 Subject: [PATCH] url: Fix moving to a new version --- include/url.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/url.php b/include/url.php index 93e11ae..0419168 100644 --- a/include/url.php +++ b/include/url.php @@ -138,6 +138,10 @@ class Url { if(!$this->iUrlId) return FALSE; + $oUrl = new url($this->iUrlId); + + if($this->iVersionId && !$iVersionId) + $iVersionId = $this->iVersionId; $sWhatChanged = ""; @@ -159,7 +163,7 @@ class Url { $this->sUrl = $sUrl; } - if ($iVersionId && $iVersionId!=$this->iVersionId) + if ($iVersionId && $iVersionId!=$oUrl->iVersionId) { if (!query_parameters("UPDATE appData SET versionId = '?' WHERE id = '?'", $iVersionId, $this->iUrlId)) @@ -519,8 +523,10 @@ class Url { public function objectSetParent($iNewId, $sClass = '') { - $oAppData = new appData($this->iUrlId, null, $this); - return $oAppData->objectSetParent($iNewId, $sClass); + if($this->iVersionId) + $this->iVersionId = $iNewId; + else + $this->iAppId = $iNewId; } function objectGetChildren($bIncludeDeleted = false)