Commit c2e95590d543731e33525246ed251e2d99a64ae9
1 parent
0ff6d4b8
Added function to remove document_word_link entries when a document is deleted
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1612 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
23 additions
and
0 deletions
lib/documentmanagement/Document.inc
| ... | ... | @@ -353,6 +353,7 @@ class Document { |
| 353 | 353 | return false; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | + | |
| 356 | 357 | /** |
| 357 | 358 | * Begin the current document's collaboration process |
| 358 | 359 | * |
| ... | ... | @@ -1002,6 +1003,28 @@ class Document { |
| 1002 | 1003 | } |
| 1003 | 1004 | |
| 1004 | 1005 | } |
| 1006 | + | |
| 1007 | + /** | |
| 1008 | + * Static function. | |
| 1009 | + * Remove all document -> word links associated with this document | |
| 1010 | + * | |
| 1011 | + * | |
| 1012 | + */ | |
| 1013 | + function removeDocumentWordLinks($iDocumentID) { | |
| 1014 | + global $default, $lang_err_database, $lang_err_object_key; | |
| 1015 | + if ($this->iId >= 0) { | |
| 1016 | + $sql = $default->db; | |
| 1017 | + $result = $sql->query("DELETE FROM " . $default->owl_document_words_table . " WHERE document_id = $iDocumentID"); | |
| 1018 | + if ($result) { | |
| 1019 | + $this->iId = -1; | |
| 1020 | + return true; | |
| 1021 | + } | |
| 1022 | + $_SESSION["errorMessage"] = $lang_err_database; | |
| 1023 | + return false; | |
| 1024 | + } | |
| 1025 | + $_SESSION["errorMessage"] = $lang_err_object_key; | |
| 1026 | + return false; | |
| 1027 | + } | |
| 1005 | 1028 | } |
| 1006 | 1029 | |
| 1007 | 1030 | ?> | ... | ... |