status may be S_NEED_CORRECTiON in setStatus()

This commit is contained in:
Uwe Steinmann 2018-01-30 19:17:44 +01:00
parent 4fa0efa07d
commit 231af615af

View File

@ -79,6 +79,12 @@ define("S_OBSOLETE", -2);
*/
define("S_EXPIRED", -3);
/*
* Lowest and highest status that may be set
*/
define("S_LOWEST_STATUS", -3);
define("S_HIGHEST_STATUS", 6);
/**
* The different states a workflow log can be in. This is used in
* all tables tblDocumentXXXLog
@ -2172,7 +2178,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
}
/* Remove all revisions of document version.
* This implmentation is different from the above for removing approvals
* This implementation is different from the above for removing approvals
* and reviews. It doesn't use getRevisionStatus() but reads the database
*/
$queryStr = "SELECT * FROM `tblDocumentRevisors` WHERE `documentID` = '". $this->getID() ."' AND `version` = '" . $version->_version."'";
@ -2988,6 +2994,9 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
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;
unset($this->_reviewStatus); // force to be reloaded from DB
$reviewStatus=$this->getReviewStatus();
@ -3022,8 +3031,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
}
}
unset($this->_workflow); // force to be reloaded from DB
if ($this->getWorkflow()) $this->setStatus(S_IN_WORKFLOW,$msg,$user);
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);
@ -3326,7 +3334,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
// If the supplied value lies outside of the accepted range, return an
// error.
if ($status < -3 || $status > 5) {
if ($status < S_LOWEST_STATUS || $status > S_HIGHEST_STATUS) {
return false;
}
@ -4669,7 +4677,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
}
/* If a user is added when the revision has already been startet, then
* put it in S_LOG_WAITING already.
* put it in S_IN_REVISION otherwise in S_LOG_WAITING.
*/
$st=$this->getStatus();
$queryStr = "INSERT INTO `tblDocumentRevisionLog` (`revisionID`, `status`, `comment`, `date`, `userID`) ".