verifyStatus() returns new status (or old status if not changed)

This commit is contained in:
Uwe Steinmann 2021-09-29 14:55:55 +02:00
parent fbe091eaf6
commit 43e98643ee

View File

@ -2966,7 +2966,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
unset($this->_status); unset($this->_status);
$st=$this->getStatus(); $st=$this->getStatus();
if (!$ignorecurrentstatus && ($st["status"]==S_OBSOLETE || $st["status"]==S_REJECTED || $st["status"]==S_EXPIRED )) return; if (!$ignorecurrentstatus && ($st["status"]==S_OBSOLETE || $st["status"]==S_REJECTED || $st["status"]==S_EXPIRED )) return $st['status'];
unset($this->_workflow); // force to be reloaded from DB unset($this->_workflow); // force to be reloaded from DB
$hasworkflow = $this->getWorkflow() ? true : false; $hasworkflow = $this->getWorkflow() ? true : false;
@ -3006,10 +3006,11 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
} }
/* First check for a running workflow or open reviews or approvals. */ /* First check for a running workflow or open reviews or approvals. */
if ($hasworkflow) $this->setStatus(S_IN_WORKFLOW,$msg,$user); if ($hasworkflow) { $newstatus = S_IN_WORKFLOW; $ret = $this->setStatus(S_IN_WORKFLOW,$msg,$user); }
elseif ($pendingReview) $this->setStatus(S_DRAFT_REV,$msg,$user); elseif ($pendingReview) { $newstatus = S_DRAFT_REV; $ret = $this->setStatus(S_DRAFT_REV,$msg,$user); }
elseif ($pendingApproval) $this->setStatus(S_DRAFT_APP,$msg,$user); elseif ($pendingApproval) { $newstatus = S_DRAFT_APP; $ret = $this->setStatus(S_DRAFT_APP,$msg,$user); }
else $this->setStatus(S_RELEASED,$msg,$user); else { $newstatus = S_RELEASED; $ret = $this->setStatus(S_RELEASED,$msg,$user); }
return $ret ? $newstatus : $ret;
} /* }}} */ } /* }}} */
function __construct($id, $document, $version, $comment, $date, $userID, $dir, $orgFileName, $fileType, $mimeType, $fileSize=0, $checksum='') { /* {{{ */ function __construct($id, $document, $version, $comment, $date, $userID, $dir, $orgFileName, $fileType, $mimeType, $fileSize=0, $checksum='') { /* {{{ */