Commit ab28b164e3919e251e91c19ac8fdb30b48617594
1 parent
58cf149c
Added deletion functionality
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@983 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
24 additions
and
7 deletions
lib/documentmanagement/DocumentTransaction.inc
| @@ -21,15 +21,14 @@ DEFINE("DOWNLOAD", 5); | @@ -21,15 +21,14 @@ DEFINE("DOWNLOAD", 5); | ||
| 21 | * @package lib.documentmanagement | 21 | * @package lib.documentmanagement |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | +define(1, "CREATE"); | ||
| 25 | +define(2, "UPDATE"); | ||
| 26 | +define(3, "DELETE"); | ||
| 27 | +define(4, "RENAME"); | ||
| 28 | +define(5, "MOVE"); | ||
| 29 | + | ||
| 24 | class DocumentTransaction { | 30 | class DocumentTransaction { |
| 25 | 31 | ||
| 26 | - //these values must match the values in database table document_transaction_type_lookup | ||
| 27 | - /*define(1, "CREATE"); | ||
| 28 | - define(2, "UPDATE"); | ||
| 29 | - define(3, "DELETE"); | ||
| 30 | - define(4, "RENAME"); | ||
| 31 | - define(5, "MOVE");*/ | ||
| 32 | - | ||
| 33 | /** primary key of document transaction */ | 32 | /** primary key of document transaction */ |
| 34 | var $iId; | 33 | var $iId; |
| 35 | /** primary key of document on which transaction occured */ | 34 | /** primary key of document on which transaction occured */ |
| @@ -99,6 +98,24 @@ class DocumentTransaction { | @@ -99,6 +98,24 @@ class DocumentTransaction { | ||
| 99 | 98 | ||
| 100 | } | 99 | } |
| 101 | 100 | ||
| 101 | + function delete() { | ||
| 102 | + global $default, $lang_err_database, $lang_err_object_key; | ||
| 103 | + if ($this->iId >= 0) { | ||
| 104 | + $sql = $default->db; | ||
| 105 | + // TODO: insert into sys_deleted | ||
| 106 | + //$result = $sql->query("INSERT INTO " . $default->owl_sys_deleted_table . " () VALUES ()"); | ||
| 107 | + $result = $sql->query("DELETE FROM " . $default->owl_document_transactions_table . " WHERE id = " . $this->iId); | ||
| 108 | + if ($result) { | ||
| 109 | + $this->iId = -1; | ||
| 110 | + return true; | ||
| 111 | + } | ||
| 112 | + $_SESSION["errorMessage"] = $lang_err_database; | ||
| 113 | + return false; | ||
| 114 | + } | ||
| 115 | + $_SESSION["errorMessage"] = $lang_err_object_key; | ||
| 116 | + return false; | ||
| 117 | + } | ||
| 118 | + | ||
| 102 | 119 | ||
| 103 | } | 120 | } |
| 104 | ?> | 121 | ?> |