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"); }