From 9d7c5fb4d5bea70e49a21be3ec43b6b5197b525e Mon Sep 17 00:00:00 2001 From: rob Date: Fri, 28 Feb 2003 08:39:33 +0000 Subject: [PATCH] Added new functionality to get default document type --- lib/documentmanagement/Document.inc | 2 +- lib/foldermanagement/Folder.inc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/documentmanagement/Document.inc b/lib/documentmanagement/Document.inc index 166d9bf..7803636 100644 --- a/lib/documentmanagement/Document.inc +++ b/lib/documentmanagement/Document.inc @@ -63,7 +63,7 @@ class Document { $this->sDescription = $sNewDescription; $this->iMimeTypeID = $iNewMimeID; $this->iFolderID = $iNewFolderID; - $this->iDocumentTypeID = Folder::getFolderDocumentType($this->iFolderID); + $this->iDocumentTypeID = Folder::getDefaultFolderDocumentType($this->iFolderID); $this->iMajorVersion = 0; $this->iMinorVersion = 1; $this->bIsCheckedOut = false; diff --git a/lib/foldermanagement/Folder.inc b/lib/foldermanagement/Folder.inc index 2ced7a1..9111e2f 100644 --- a/lib/foldermanagement/Folder.inc +++ b/lib/foldermanagement/Folder.inc @@ -502,17 +502,17 @@ class Folder { /** * Static function - * Get the document type for a folder + * Gets the default document type for a folder (where default is simply the first one) * * @param $iFolderID * * @return integer document type primary key, false otherwise and set $_SESSION["errorMessage"] */ - function getFolderDocumentType($iFolderID) { + function getDefaultFolderDocumentType($iFolderID) { global $default, $lang_err_database; if (Folder::folderExistsID($iFolderID)) { $sql = $default->db; - $sql->query("SELECT document_type_id FROM " . $default->owl_folder_doctypes_table . " WHERE id = " . $iFolderID); + $sql->query("SELECT document_type_id FROM " . $default->owl_folder_doctypes_table . " WHERE folder_id = " . $iFolderID); if ($sql->next_record()) { return $sql->f("document_type_id"); } -- libgit2 0.21.4