set new and old status

This commit is contained in:
Uwe Steinmann 2024-04-04 13:56:14 +02:00
parent 01837f6c5c
commit 0b4afff149

View File

@ -22,6 +22,10 @@
*/ */
class SeedDMS_Controller_ReviseDocument extends SeedDMS_Controller_Common { class SeedDMS_Controller_ReviseDocument extends SeedDMS_Controller_Common {
public $oldstatus;
public $newstatus;
public function run() { public function run() {
$dms = $this->params['dms']; $dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
@ -32,6 +36,9 @@ class SeedDMS_Controller_ReviseDocument extends SeedDMS_Controller_Common {
$revisiontype = $this->params['revisiontype']; $revisiontype = $this->params['revisiontype'];
$group = $this->params['group']; $group = $this->params['group'];
$comment = $this->params['comment']; $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 /* 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 * 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); $result = $this->callHook('reviseUpdateDocumentStatus', $content);
if($result === null) { if($result === null) {
if ($onevotereject && $revisionstatus == -1){ if ($onevotereject && $revisionstatus == -1){
$this->newstatus = S_NEEDS_CORRECTION;
if(!$content->setStatus(S_NEEDS_CORRECTION,$comment,$user)) { if(!$content->setStatus(S_NEEDS_CORRECTION,$comment,$user)) {
$this->error = 1; $this->error = 1;
$this->errormsg = "revision_update_failed"; $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. // of them were rejections then documents needs correction.
// Otherwise put it back into revision workflow // Otherwise put it back into revision workflow
if ($revisionok == $revisionTotal) { if ($revisionok == $revisionTotal) {
$newStatus=S_RELEASED; $this->newstatus=S_RELEASED;
if ($content->finishRevision($user, $newStatus, 'Finished revision workflow', getMLText("automatic_status_update"))) { if ($content->finishRevision($user, $this->newstatus, 'Finished revision workflow', getMLText("automatic_status_update"))) {
if(!$this->callHook('finishReviseDocument', $content)) { if(!$this->callHook('finishReviseDocument', $content)) {
} }
} }
} elseif (($revisionok + $revisionnotok) == $revisionTotal) { } elseif (($revisionok + $revisionnotok) == $revisionTotal) {
$newStatus=S_NEEDS_CORRECTION; $this->newstatus=S_NEEDS_CORRECTION;
// if ($content->finishRevision($user, $newStatus, 'Finished revision workflow', getMLText("automatic_status_update"))) { // if ($content->finishRevision($user, $this->newstatus, 'Finished revision workflow', getMLText("automatic_status_update"))) {
if(!$content->setStatus($newStatus,$comment,$user)) { if(!$content->setStatus($this->newstatus,$comment,$user)) {
$this->error = 1; $this->error = 1;
$this->errormsg = "revision_update_failed"; $this->errormsg = "revision_update_failed";
return false; return false;
} }
} else { } else {
$newStatus=S_IN_REVISION; $this->newstatus=S_IN_REVISION;
if(!$content->setStatus($newStatus,$comment,$user)) { if(!$content->setStatus($this->newstatus,$comment,$user)) {
$this->error = 1; $this->error = 1;
$this->errormsg = "revision_update_failed"; $this->errormsg = "revision_update_failed";
return false; return false;