diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index 2ceb12874..3e12f6edf 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -1020,7 +1020,10 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ /** * Get checkout info for document * - * @return array/boolean record from table tblDocumentCheckOuts or false + * This returns the checkouts for a document. There could be several checkouts + * for one document, but usually there is just one. + * + * @return array/boolean records from table tblDocumentCheckOuts or false * in case of an error. */ function getCheckOutInfo() { /* {{{ */ @@ -1033,7 +1036,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ return false; } else { // A check out has been identified for this document. - return $resArr[0]; + return $resArr; } } /* }}} */ @@ -1114,7 +1117,10 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ function checkIn($comment, $user, $reviewers=array(), $approvers=array(), $version=0, $attributes=array(), $workflow=null, $initstate=S_RELEASED) { /* {{{ */ $db = $this->_dms->getDB(); - $info = self::getCheckOutInfo(); + $infos = self::getCheckOutInfo(); + if(!$infos) + return false; + $info = $infos[0]; $lc = self::getLatestContent(); /* If file doesn't exist anymore, then just remove the record from the db */ @@ -1168,12 +1174,14 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ function cancelCheckOut() { /* {{{ */ $db = $this->_dms->getDB(); - $info = self::getCheckOutInfo(); - if($info) { - SeedDMS_Core_File::removeFile($info['filename']); + $infos = self::getCheckOutInfo(); + if($infos) { + $info = $infos[0]; $queryStr = "DELETE FROM `tblDocumentCheckOuts` WHERE `document` = ".$this->_id; - $db->getResult($queryStr); + if (!$db->getResult($queryStr)) + return false; + SeedDMS_Core_File::removeFile($info['filename']); } return true; @@ -1193,10 +1201,11 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ * 0=The checked out file is modified and check in will create a new version */ function checkOutStatus() { /* {{{ */ - $info = self::getCheckOutInfo(); - if(!$info) + $infos = self::getCheckOutInfo(); + if(!$infos) return 4; + $info = $infos[0]; $lc = self::getLatestContent(); /* If file doesn't exist anymore, then just remove the record from the db */ diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index 1a9725b47..e2a4c82eb 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -194,17 +194,20 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { $txt = $this->callHook('checkOutInfo', $document); if(is_string($txt)) { echo $txt; - } elseif($info = $document->getCheckOutInfo()) { - echo "