diff --git a/lib/documentmanagement/Document.inc b/lib/documentmanagement/Document.inc index f9c5a43..3cbe1d8 100644 --- a/lib/documentmanagement/Document.inc +++ b/lib/documentmanagement/Document.inc @@ -1025,6 +1025,22 @@ class Document { $_SESSION["errorMessage"] = $lang_err_object_key; return false; } + + function deleteDocumentFieldsLinks($iDocumentID) { + global $default, $lang_err_database, $lang_err_object_key; + if ($this->iId >= 0) { + $sql = $default->db; + $result = $sql->query("DELETE FROM " . $default->owl_document_fields_table . " WHERE document_id = $iDocumentID"); + if ($result) { + $this->iId = -1; + return true; + } + $_SESSION["errorMessage"] = $lang_err_database; + return false; + } + $_SESSION["errorMessage"] = $lang_err_object_key; + return false; + } } ?> diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php index 8c8c82c..9bbea8c 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php @@ -71,7 +71,10 @@ if (checkSession()) { //remove any document word links that this document may have Document::removeDocumentWordLinks($fDocumentID); - + + //delete all fields associated with the document + Document::deleteDocumentFieldsLinks($fDocumentID); + // redirect to the browse folder page redirect("$default->rootUrl/control.php?action=browse&fFolderID=" . $oDocument->getFolderID()); } else {