mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-10-17 05:22:23 +00:00
add new list type ´DueRevision' in getDocumentList()
This commit is contained in:
parent
fa96dca929
commit
feee5600c4
|
@ -808,7 +808,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Check if latest content of the document has a schedult
|
||||
* Check if latest content of the document has a scheduled
|
||||
* revision workflow.
|
||||
* The method will update the document status log database table
|
||||
* if needed.
|
||||
|
@ -825,8 +825,9 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
if($lc) {
|
||||
$st=$lc->getStatus();
|
||||
|
||||
/* A revision workflow will only be started if the document is released */
|
||||
if($st["status"] == S_RELEASED) {
|
||||
/* First check if there are any revisors left who need to revise */
|
||||
/* First check if there are any scheduled revisions currently sleeping */
|
||||
$pendingRevision=false;
|
||||
unset($this->_revisionStatus); // force to be reloaded from DB
|
||||
$revisionStatus=$lc->getRevisionStatus();
|
||||
|
@ -841,7 +842,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
if(!$pendingRevision)
|
||||
return false;
|
||||
|
||||
/* Second check if revision is already due */
|
||||
/* We have sleeping revision, next check if the revision is already due */
|
||||
if($lc->getRevisionDate() && $lc->getRevisionDate() <= date('Y-m-d 00:00:00')) {
|
||||
if($lc->startRevision($user, 'Automatic start of revision workflow')) {
|
||||
if($next) {
|
||||
|
@ -3051,23 +3052,30 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
* This method will call {@see SeedDMS_Core_DocumentContent::setStatus()}
|
||||
* which checks if the state has actually changed. This is, why this
|
||||
* function can be called at any time without harm to the status log.
|
||||
* The $initialstatus can be set, to define the status set when no other
|
||||
* status is set. This happens if the document has no
|
||||
*
|
||||
* @param boolean $ignorecurrentstatus ignore the current status and
|
||||
* recalculate a new status in any case
|
||||
* @param object $user the user initiating this method
|
||||
* @param string $msg message stored in status log when status is set
|
||||
* @param integer $initialstatus status to be set if no other status is set
|
||||
*/
|
||||
function verifyStatus($ignorecurrentstatus=false, $user=null, $msg='') { /* {{{ */
|
||||
function verifyStatus($ignorecurrentstatus=false, $user=null, $msg='', $initialstatus=S_RELEASED) { /* {{{ */
|
||||
|
||||
unset($this->_status);
|
||||
$st=$this->getStatus();
|
||||
|
||||
/* Documents already obsoleted, rejected or expired will not change
|
||||
* its status anymore, unless explicitly requested.
|
||||
*/
|
||||
if (!$ignorecurrentstatus && ($st["status"]==S_OBSOLETE || $st["status"]==S_REJECTED || $st["status"]==S_EXPIRED )) return;
|
||||
|
||||
unset($this->_workflow); // force to be reloaded from DB
|
||||
$hasworkflow = $this->getWorkflow() ? true : false;
|
||||
|
||||
$pendingReview=false;
|
||||
$hasReview=false;
|
||||
unset($this->_reviewStatus); // force to be reloaded from DB
|
||||
$reviewStatus=$this->getReviewStatus();
|
||||
if (is_array($reviewStatus) && count($reviewStatus)>0) {
|
||||
|
@ -3075,10 +3083,13 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
if ($r["status"]==0){
|
||||
$pendingReview=true;
|
||||
break;
|
||||
} elseif($r["status"]==1){
|
||||
$hasReview=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
$pendingApproval=false;
|
||||
$hasApproval=false;
|
||||
unset($this->_approvalStatus); // force to be reloaded from DB
|
||||
$approvalStatus=$this->getApprovalStatus();
|
||||
if (is_array($approvalStatus) && count($approvalStatus)>0) {
|
||||
|
@ -3086,10 +3097,13 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
if ($a["status"]==0){
|
||||
$pendingApproval=true;
|
||||
break;
|
||||
} elseif($a["status"]==1){
|
||||
$hasApproval=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
$pendingRevision=false;
|
||||
$hasRevision=false;
|
||||
unset($this->_revisionStatus); // force to be reloaded from DB
|
||||
$revsisionStatus=$this->getRevisionStatus();
|
||||
if (is_array($revsisionStatus) && count($revsisionStatus)>0) {
|
||||
|
@ -3097,16 +3111,29 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
if ($a["status"]==0){
|
||||
$pendingRevision=true;
|
||||
break;
|
||||
} elseif($a["status"]==1){
|
||||
$hasRevision=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* First check for an open review, approval, revision. */
|
||||
if ($hasworkflow) $this->setStatus(S_IN_WORKFLOW,$msg,$user);
|
||||
elseif ($pendingReview) $this->setStatus(S_DRAFT_REV,$msg,$user);
|
||||
elseif ($pendingApproval) $this->setStatus(S_DRAFT_APP,$msg,$user);
|
||||
elseif ($pendingRevision) $this->setStatus(S_IN_REVISION,$msg,$user);
|
||||
/* A document in status S_DRAFT will never go into S_RELEASED */
|
||||
elseif ($st["status"]!=S_DRAFT) $this->setStatus(S_RELEASED,$msg,$user);
|
||||
/* Finally decide what to do if either no review, approval, revision was
|
||||
* ever done or if one of them has been done. In the first case it will
|
||||
* go to the initial status, in the second case, it will be released.
|
||||
* A document in status S_DRAFT will never go into S_RELEASED and document
|
||||
* already released will never go back at this point into the given
|
||||
* initial status, which can only by S_DRAFT or S_RELEASED
|
||||
*/
|
||||
elseif ($st["status"]!=S_DRAFT && $st["status"]!=S_RELEASED ) {
|
||||
if($hasReview || $hasApproval || $hasRevision) $this->setStatus(S_RELEASED,$msg,$user);
|
||||
else $this->setStatus($initialstatus,$msg,$user);
|
||||
}
|
||||
|
||||
} /* }}} */
|
||||
|
||||
function __construct($id, $document, $version, $comment, $date, $userID, $dir, $orgFileName, $fileType, $mimeType, $fileSize=0, $checksum='', $revisionDate=null) { /* {{{ */
|
||||
|
@ -3398,6 +3425,15 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
|||
if (is_bool($res) && !$res)
|
||||
return false;
|
||||
|
||||
/* Check if 'onSetStatus' callback is set */
|
||||
if(isset($this->_dms->callbacks['onSetStatus'])) {
|
||||
foreach($this->_dms->callbacks['onSetStatus'] as $callback) {
|
||||
$ret = call_user_func($callback[0], $callback[1], $this, $this->_status["status"], $status);
|
||||
if(is_bool($ret))
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
unset($this->_status);
|
||||
return true;
|
||||
} /* }}} */
|
||||
|
|
Loading…
Reference in New Issue
Block a user