diff --git a/controllers/class.ReviseDocument.php b/controllers/class.ReviseDocument.php index 94f085d6d..6abda8b03 100644 --- a/controllers/class.ReviseDocument.php +++ b/controllers/class.ReviseDocument.php @@ -22,6 +22,10 @@ */ class SeedDMS_Controller_ReviseDocument extends SeedDMS_Controller_Common { + public $oldstatus; + + public $newstatus; + public function run() { $dms = $this->params['dms']; $user = $this->params['user']; @@ -32,6 +36,9 @@ class SeedDMS_Controller_ReviseDocument extends SeedDMS_Controller_Common { $revisiontype = $this->params['revisiontype']; $group = $this->params['group']; $comment = $this->params['comment']; + $overallStatus = $content->getStatus(); + $this->oldstatus = $overallStatus['status']; + $this->newstatus = $this->oldstatus; /* if set to true, a single reject will reject the doc. If set to false * all revisions will be collected first and afterwards the doc is rejected @@ -71,6 +78,7 @@ class SeedDMS_Controller_ReviseDocument extends SeedDMS_Controller_Common { $result = $this->callHook('reviseUpdateDocumentStatus', $content); if($result === null) { if ($onevotereject && $revisionstatus == -1){ + $this->newstatus = S_NEEDS_CORRECTION; if(!$content->setStatus(S_NEEDS_CORRECTION,$comment,$user)) { $this->error = 1; $this->errormsg = "revision_update_failed"; @@ -102,22 +110,22 @@ class SeedDMS_Controller_ReviseDocument extends SeedDMS_Controller_Common { // of them were rejections then documents needs correction. // Otherwise put it back into revision workflow if ($revisionok == $revisionTotal) { - $newStatus=S_RELEASED; - if ($content->finishRevision($user, $newStatus, 'Finished revision workflow', getMLText("automatic_status_update"))) { + $this->newstatus=S_RELEASED; + if ($content->finishRevision($user, $this->newstatus, 'Finished revision workflow', getMLText("automatic_status_update"))) { if(!$this->callHook('finishReviseDocument', $content)) { } } } elseif (($revisionok + $revisionnotok) == $revisionTotal) { - $newStatus=S_NEEDS_CORRECTION; -// if ($content->finishRevision($user, $newStatus, 'Finished revision workflow', getMLText("automatic_status_update"))) { - if(!$content->setStatus($newStatus,$comment,$user)) { + $this->newstatus=S_NEEDS_CORRECTION; +// if ($content->finishRevision($user, $this->newstatus, 'Finished revision workflow', getMLText("automatic_status_update"))) { + if(!$content->setStatus($this->newstatus,$comment,$user)) { $this->error = 1; $this->errormsg = "revision_update_failed"; return false; } } else { - $newStatus=S_IN_REVISION; - if(!$content->setStatus($newStatus,$comment,$user)) { + $this->newstatus=S_IN_REVISION; + if(!$content->setStatus($this->newstatus,$comment,$user)) { $this->error = 1; $this->errormsg = "revision_update_failed"; return false;