Commit 17a01479514a0664dd3019fdfb01be8d8b2c4fdc
1 parent
0b6f626f
added checkedOutUserID and corrected update and set/get bugs
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1151 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
21 additions
and
6 deletions
lib/documentmanagement/Document.inc
| ... | ... | @@ -36,6 +36,8 @@ class Document { |
| 36 | 36 | var $iMinorVersion; |
| 37 | 37 | /** document checked out status */ |
| 38 | 38 | var $bIsCheckedOut; |
| 39 | + /** the user that currently has the document checked out */ | |
| 40 | + var $iCheckedOutUserID; | |
| 39 | 41 | /** comma delimited string of folder hierarch this document falls under */ |
| 40 | 42 | var $sParentFolderIDs; |
| 41 | 43 | /** forward slash deliminated path from file system root */ |
| ... | ... | @@ -65,6 +67,7 @@ class Document { |
| 65 | 67 | $this->iMajorVersion = 0; |
| 66 | 68 | $this->iMinorVersion = 1; |
| 67 | 69 | $this->bIsCheckedOut = false; |
| 70 | + $this->iCheckedOutUserID = -1; | |
| 68 | 71 | } |
| 69 | 72 | |
| 70 | 73 | /** Get the document primary key */ |
| ... | ... | @@ -179,7 +182,7 @@ class Document { |
| 179 | 182 | |
| 180 | 183 | /** set the minor version number */ |
| 181 | 184 | function setMinorVersionNumber($iNewValue) { |
| 182 | - $this->iMinorVersionNumber = $iNewValue; | |
| 185 | + $this->iMinorVersion = $iNewValue; | |
| 183 | 186 | } |
| 184 | 187 | |
| 185 | 188 | /** get the document check out status */ |
| ... | ... | @@ -192,6 +195,16 @@ class Document { |
| 192 | 195 | $this->bIsCheckedOut = $bNewValue; |
| 193 | 196 | } |
| 194 | 197 | |
| 198 | + /** get the user id that has the document checked out **/ | |
| 199 | + function getCheckedOutUserID() { | |
| 200 | + return $this->iCheckedOutUserID; | |
| 201 | + } | |
| 202 | + | |
| 203 | + /** set the user id that has the document checked out **/ | |
| 204 | + function setCheckedOutUserID($iNewValue) { | |
| 205 | + $this->iCheckedOutUserID = $iNewValue; | |
| 206 | + } | |
| 207 | + | |
| 195 | 208 | /** |
| 196 | 209 | * Generate a comma delimited string containing |
| 197 | 210 | * the parent folder ids |
| ... | ... | @@ -275,8 +288,8 @@ class Document { |
| 275 | 288 | "description = '" . addslashes($this->sDescription) . "', " . |
| 276 | 289 | "mime_id = $this->iMimeTypeID, " . |
| 277 | 290 | "folder_id = " . $this->iFolderID . ", " . |
| 278 | - "major_version = $this->iMajorVersion, " . | |
| 279 | - "minor_version = $this->iMinorVersion, "; | |
| 291 | + "major_version = " . $this->iMajorVersion . ", " . | |
| 292 | + "minor_version = " . $this->iMinorVersion . ", "; | |
| 280 | 293 | if ($aForMove) { |
| 281 | 294 | //only update these if the document is being moved |
| 282 | 295 | $sFullPath = $this->generateFullFolderPath($this->iFolderID); |
| ... | ... | @@ -286,8 +299,9 @@ class Document { |
| 286 | 299 | $sQuery .= "parent_folder_ids = '" . addslashes($this->sParentFolderIDs) . "'," . |
| 287 | 300 | "full_path = '" . addslashes($this->sFullPath) . "', "; |
| 288 | 301 | } |
| 289 | - $sQuery .= "is_checked_out = " . ($this->bIsCheckedOut ? "1" : "0") . " " . | |
| 290 | - "WHERE id = $this->iId"; | |
| 302 | + $sQuery .= "is_checked_out = " . ($this->bIsCheckedOut ? "1" : "0") . ", " . | |
| 303 | + "checked_out_user_id = " . $this->iCheckedOutUserID . " " . | |
| 304 | + "WHERE id = $this->iId"; | |
| 291 | 305 | $result = $sql->query($sQuery); |
| 292 | 306 | if ($result) { |
| 293 | 307 | return true; |
| ... | ... | @@ -404,7 +418,8 @@ class Document { |
| 404 | 418 | $oDocument->setIsCheckedOut($sql->f("is_checked_out")); |
| 405 | 419 | $oDocument->sParentFolderIDs = stripslashes($sql->f("parent_folder_ids")); |
| 406 | 420 | $oDocument->sFullPath = stripslashes($sql->f("full_path")); |
| 407 | - $oDocument->iId = $iDocumentID; | |
| 421 | + $oDocument->iId = $iDocumentID; | |
| 422 | + $oDocument->setCheckedOutUserID = $sql->f("checked_out_user_id"); | |
| 408 | 423 | return $oDocument; |
| 409 | 424 | } |
| 410 | 425 | $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = documents"; | ... | ... |