maySetReviewersApprovers() checks if review/approval has been done already

This commit is contained in:
Uwe Steinmann 2017-08-02 10:53:50 +02:00
parent 0c3355ed9d
commit ea8a695551

View File

@ -114,15 +114,28 @@ class SeedDMS_AccessOperation {
* *
* This check can only be done for documents. Overwriting the document * This check can only be done for documents. Overwriting the document
* reviewers/approvers is only allowed if version modification is turned on * reviewers/approvers is only allowed if version modification is turned on
* in the settings and the document is in 'draft review' status. The * in the settings and the document has not been reviewed/approved by any
* admin may even set reviewers/approvers if is disallowed in the * user/group already.
* The admin may even set reviewers/approvers if is disallowed in the
* settings. * settings.
*/ */
function maySetReviewersApprovers() { /* {{{ */ function maySetReviewersApprovers() { /* {{{ */
if(get_class($this->obj) == 'SeedDMS_Core_Document') { if(get_class($this->obj) == 'SeedDMS_Core_Document') {
$latestContent = $this->obj->getLatestContent(); $latestContent = $this->obj->getLatestContent();
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && ($status["status"]==S_DRAFT_REV || $status["status"]==S_DRAFT_APP && $this->settings->_workflowMode == 'traditional_only_approval')) { $reviewstatus = $latestContent->getReviewStatus();
$hasreview = false;
foreach($reviewstatus as $r) {
if($r['status'] == 1 || $r['status'] == -1)
$hasreview = true;
}
$approvalstatus = $latestContent->getApprovalStatus();
$hasapproval = false;
foreach($approvalstatus as $r) {
if($r['status'] == 1 || $r['status'] == -1)
$hasapproval = true;
}
if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && (($status["status"]==S_DRAFT_REV && !$hasreview) || ($status["status"]==S_DRAFT_APP && !$hasreview && !$hasapproval))) {
return true; return true;
} }
} }