diff --git a/include/note.php b/include/note.php index bde0e77..fec4edf 100644 --- a/include/note.php +++ b/include/note.php @@ -115,14 +115,30 @@ class Note { $sWhatChanged .= "Description was changed from\n ".$oNote->shDescription."\n to \n".$this->shDescription.".\n\n"; } - if ($this->iVersionId && $this->iVersionId!=$oNote->iVersionId) + if (($this->iVersionId || $this->iAppId) && $this->iVersionId!=$oNote->iVersionId) { if (!query_parameters("UPDATE appNotes SET versionId = '?' WHERE noteId = '?'", $this->iVersionId, $this->iNoteId)) return false; + $sVersionBefore = Version::lookup_name($oNote->iVersionId); - $sVersionAfter = Version::lookup_name($this->iVersionId); - $sWhatChanged .= "Version was changed from ".$sVersionBefore." to ".$sVersionAfter.".\n\n"; + + if(!$this->iAppId) + { + $sVersionAfter = Version::lookup_name($this->iVersionId); + $sWhatChanged .= "Version was changed from ".$sVersionBefore." to ".$sVersionAfter.".\n\n"; + } else + { + $oApp = new application($this->iAppId); + $sNewApp = $oApp->sName; + $sWhatChanged .= "Moved from version $shVersionBefore to application $sNewApp"; + } + } + if (($this->iAppId || $this->iVersionId) && $this->iAppId!=$oNote->iAppId) + { + if(!query_parameters("UPDATE appNotes SET appId = '?' WHERE noteId = '?'", + $this->iAppId, $this->iNoteId)) + return false; } if($sWhatChanged) $this->SendNotificationMail("edit",$sWhatChanged); @@ -310,23 +326,31 @@ class Note { } } + public static function isRealVersionId($iVersionId) + { + return $iVersionId > 0; + } + function outputEditor($aValues = null) { - if($aValues) + if(!$this->iVersionId) + $this->iVersionId = getInput('iVersionId', $aValues); + + if(!$this->iAppId) + $this->iAppId = getInput('iAppId', $aValues); + + if($this->iAppId && !$this->iVersionId) + $this->iVersionId = APPNOTE_SHOW_FOR_ALL; + + if(!$this->iAppId) { - if(!$this->iVersionId) - $this->iVersionId = $aValues['iVersionId']; - - if(!$this->iAppId) - $this->iAppId = getInput('iAppId', $aValues); - - if($this->iAppId && !$this->iVersionId) - $this->iVersionId = APPNOTE_SHOW_FOR_ALL; - - if(!$this->sTitle) - $this->sTitle = $aValues['sNoteTitle']; + $oVersion = new version($this->iVersionId); + $this->iAppId = $oVersion->iAppId; } + if(!$this->sTitle) + $this->sTitle = getInput('sNoteTitle', $aValues); + HtmlAreaLoaderScript(array("editor")); echo html_frame_start("Edit Application Note {$aClean['noteId']}", "90%","",0); @@ -334,8 +358,7 @@ class Note { echo ''; echo ''; - if(!$this->iAppId) - echo ''; + echo ''; echo '