Commit db7fe73a214d785cdcfc2cb3ce52c78092cfa65d

Authored by rob
1 parent 9c048ade

Added functionality to remove document_field_link entries when a document is deleted


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1614 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/Document.inc
@@ -1025,6 +1025,22 @@ class Document { @@ -1025,6 +1025,22 @@ class Document {
1025 $_SESSION["errorMessage"] = $lang_err_object_key; 1025 $_SESSION["errorMessage"] = $lang_err_object_key;
1026 return false; 1026 return false;
1027 } 1027 }
  1028 +
  1029 + function deleteDocumentFieldsLinks($iDocumentID) {
  1030 + global $default, $lang_err_database, $lang_err_object_key;
  1031 + if ($this->iId >= 0) {
  1032 + $sql = $default->db;
  1033 + $result = $sql->query("DELETE FROM " . $default->owl_document_fields_table . " WHERE document_id = $iDocumentID");
  1034 + if ($result) {
  1035 + $this->iId = -1;
  1036 + return true;
  1037 + }
  1038 + $_SESSION["errorMessage"] = $lang_err_database;
  1039 + return false;
  1040 + }
  1041 + $_SESSION["errorMessage"] = $lang_err_object_key;
  1042 + return false;
  1043 + }
1028 } 1044 }
1029 1045
1030 ?> 1046 ?>
presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php
@@ -71,7 +71,10 @@ if (checkSession()) { @@ -71,7 +71,10 @@ if (checkSession()) {
71 71
72 //remove any document word links that this document may have 72 //remove any document word links that this document may have
73 Document::removeDocumentWordLinks($fDocumentID); 73 Document::removeDocumentWordLinks($fDocumentID);
74 - 74 +
  75 + //delete all fields associated with the document
  76 + Document::deleteDocumentFieldsLinks($fDocumentID);
  77 +
75 // redirect to the browse folder page 78 // redirect to the browse folder page
76 redirect("$default->rootUrl/control.php?action=browse&fFolderID=" . $oDocument->getFolderID()); 79 redirect("$default->rootUrl/control.php?action=browse&fFolderID=" . $oDocument->getFolderID());
77 } else { 80 } else {