Commit 9d7c5fb4d5bea70e49a21be3ec43b6b5197b525e

Authored by rob
1 parent 22944635

Added new functionality to get default document type


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1192 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/Document.inc
... ... @@ -63,7 +63,7 @@ class Document {
63 63 $this->sDescription = $sNewDescription;
64 64 $this->iMimeTypeID = $iNewMimeID;
65 65 $this->iFolderID = $iNewFolderID;
66   - $this->iDocumentTypeID = Folder::getFolderDocumentType($this->iFolderID);
  66 + $this->iDocumentTypeID = Folder::getDefaultFolderDocumentType($this->iFolderID);
67 67 $this->iMajorVersion = 0;
68 68 $this->iMinorVersion = 1;
69 69 $this->bIsCheckedOut = false;
... ...
lib/foldermanagement/Folder.inc
... ... @@ -502,17 +502,17 @@ class Folder {
502 502  
503 503 /**
504 504 * Static function
505   - * Get the document type for a folder
  505 + * Gets the default document type for a folder (where default is simply the first one)
506 506 *
507 507 * @param $iFolderID
508 508 *
509 509 * @return integer document type primary key, false otherwise and set $_SESSION["errorMessage"]
510 510 */
511   - function getFolderDocumentType($iFolderID) {
  511 + function getDefaultFolderDocumentType($iFolderID) {
512 512 global $default, $lang_err_database;
513 513 if (Folder::folderExistsID($iFolderID)) {
514 514 $sql = $default->db;
515   - $sql->query("SELECT document_type_id FROM " . $default->owl_folder_doctypes_table . " WHERE id = " . $iFolderID);
  515 + $sql->query("SELECT document_type_id FROM " . $default->owl_folder_doctypes_table . " WHERE folder_id = " . $iFolderID);
516 516 if ($sql->next_record()) {
517 517 return $sql->f("document_type_id");
518 518 }
... ...