mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 12:11:19 +00:00
SeedDMS_Core_Document::getCheckOutInfo() returns all checkout versions
This commit is contained in:
parent
858c449489
commit
152c943d5a
|
@ -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 */
|
||||
|
|
|
@ -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 "<div class=\"alert alert-info\">";
|
||||
} elseif($infos = $document->getCheckOutInfo()) {
|
||||
$session = $this->params['session'];
|
||||
if($session->getSu()) {
|
||||
$origuser = $dms->getUser($session->getUser());
|
||||
$checkoutpath = sprintf($checkoutdir, preg_replace('/[^A-Za-z0-9_-]/', '', $origuser->getLogin()));
|
||||
} else {
|
||||
$origuser = $user;
|
||||
$checkoutpath = sprintf($checkoutdir, preg_replace('/[^A-Za-z0-9_-]/', '', $user->getLogin()));
|
||||
}
|
||||
echo "<a href=\"file://".$info['filename']."\">".getMLText('copied_to_checkout_as', array('date'=>$info['date'], 'filename'=>substr($info['filename'], strlen($checkoutpath)+1)))."</a>";
|
||||
echo "</div>";
|
||||
foreach($infos as $info) {
|
||||
echo "<div class=\"alert alert-info\">";
|
||||
echo "<a href=\"file://".$info['filename']."\">".getMLText('copied_to_checkout_as', array('date'=>$info['date'], 'filename'=>substr($info['filename'], strlen($checkoutpath)+1)))."</a>";
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
$this->contentContainerStart();
|
||||
$txt = $this->callHook('preDocumentInfos', $document);
|
||||
|
|
Loading…
Reference in New Issue
Block a user