From c2e95590d543731e33525246ed251e2d99a64ae9 Mon Sep 17 00:00:00 2001 From: rob Date: Tue, 18 Mar 2003 12:44:11 +0000 Subject: [PATCH] Added function to remove document_word_link entries when a document is deleted --- lib/documentmanagement/Document.inc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+), 0 deletions(-) diff --git a/lib/documentmanagement/Document.inc b/lib/documentmanagement/Document.inc index 7bc2be0..f9c5a43 100644 --- a/lib/documentmanagement/Document.inc +++ b/lib/documentmanagement/Document.inc @@ -353,6 +353,7 @@ class Document { return false; } + /** * Begin the current document's collaboration process * @@ -1002,6 +1003,28 @@ class Document { } } + + /** + * Static function. + * Remove all document -> word links associated with this document + * + * + */ + function removeDocumentWordLinks($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_words_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; + } } ?> -- libgit2 0.21.4