Commit 17a01479514a0664dd3019fdfb01be8d8b2c4fdc

Authored by michael
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
lib/documentmanagement/Document.inc
@@ -36,6 +36,8 @@ class Document { @@ -36,6 +36,8 @@ class Document {
36 var $iMinorVersion; 36 var $iMinorVersion;
37 /** document checked out status */ 37 /** document checked out status */
38 var $bIsCheckedOut; 38 var $bIsCheckedOut;
  39 + /** the user that currently has the document checked out */
  40 + var $iCheckedOutUserID;
39 /** comma delimited string of folder hierarch this document falls under */ 41 /** comma delimited string of folder hierarch this document falls under */
40 var $sParentFolderIDs; 42 var $sParentFolderIDs;
41 /** forward slash deliminated path from file system root */ 43 /** forward slash deliminated path from file system root */
@@ -65,6 +67,7 @@ class Document { @@ -65,6 +67,7 @@ class Document {
65 $this->iMajorVersion = 0; 67 $this->iMajorVersion = 0;
66 $this->iMinorVersion = 1; 68 $this->iMinorVersion = 1;
67 $this->bIsCheckedOut = false; 69 $this->bIsCheckedOut = false;
  70 + $this->iCheckedOutUserID = -1;
68 } 71 }
69 72
70 /** Get the document primary key */ 73 /** Get the document primary key */
@@ -179,7 +182,7 @@ class Document { @@ -179,7 +182,7 @@ class Document {
179 182
180 /** set the minor version number */ 183 /** set the minor version number */
181 function setMinorVersionNumber($iNewValue) { 184 function setMinorVersionNumber($iNewValue) {
182 - $this->iMinorVersionNumber = $iNewValue; 185 + $this->iMinorVersion = $iNewValue;
183 } 186 }
184 187
185 /** get the document check out status */ 188 /** get the document check out status */
@@ -192,6 +195,16 @@ class Document { @@ -192,6 +195,16 @@ class Document {
192 $this->bIsCheckedOut = $bNewValue; 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 * Generate a comma delimited string containing 209 * Generate a comma delimited string containing
197 * the parent folder ids 210 * the parent folder ids
@@ -275,8 +288,8 @@ class Document { @@ -275,8 +288,8 @@ class Document {
275 "description = '" . addslashes($this->sDescription) . "', " . 288 "description = '" . addslashes($this->sDescription) . "', " .
276 "mime_id = $this->iMimeTypeID, " . 289 "mime_id = $this->iMimeTypeID, " .
277 "folder_id = " . $this->iFolderID . ", " . 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 if ($aForMove) { 293 if ($aForMove) {
281 //only update these if the document is being moved 294 //only update these if the document is being moved
282 $sFullPath = $this->generateFullFolderPath($this->iFolderID); 295 $sFullPath = $this->generateFullFolderPath($this->iFolderID);
@@ -286,8 +299,9 @@ class Document { @@ -286,8 +299,9 @@ class Document {
286 $sQuery .= "parent_folder_ids = '" . addslashes($this->sParentFolderIDs) . "'," . 299 $sQuery .= "parent_folder_ids = '" . addslashes($this->sParentFolderIDs) . "'," .
287 "full_path = '" . addslashes($this->sFullPath) . "', "; 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 $result = $sql->query($sQuery); 305 $result = $sql->query($sQuery);
292 if ($result) { 306 if ($result) {
293 return true; 307 return true;
@@ -404,7 +418,8 @@ class Document { @@ -404,7 +418,8 @@ class Document {
404 $oDocument->setIsCheckedOut($sql->f("is_checked_out")); 418 $oDocument->setIsCheckedOut($sql->f("is_checked_out"));
405 $oDocument->sParentFolderIDs = stripslashes($sql->f("parent_folder_ids")); 419 $oDocument->sParentFolderIDs = stripslashes($sql->f("parent_folder_ids"));
406 $oDocument->sFullPath = stripslashes($sql->f("full_path")); 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 return $oDocument; 423 return $oDocument;
409 } 424 }
410 $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = documents"; 425 $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = documents";