diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index b7ab3314b..398abfb0b 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -3404,7 +3404,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ */ if (!$ignorecurrentstatus && ($st["status"]==S_OBSOLETE || $st["status"]==S_REJECTED || $st["status"]==S_EXPIRED || $st["status"]==S_NEEDS_CORRECTION)) return $st['status']; - unset($this->_workflow); // force to be reloaded from DB + $this->_workflow = null; // force to be reloaded from DB $hasworkflow = $this->getWorkflow() ? true : false; /* $pendingReview will be set when there are still open reviews */ @@ -6317,6 +6317,10 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ * $this->_workflow['parent']. $this->_workflow['id'] is the * id from table tblWorkflowDocumentContent which is used to * get log entries for this workflow. + * This method will only get a currently running workflow in + * a state. Once + * workflow has ended, the current state of the workflow was + * set to null. * * @return object/boolean an object of class SeedDMS_Core_Workflow * or false in case of error, e.g. the version has not a workflow @@ -6324,7 +6328,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ function getWorkflow() { /* {{{ */ $db = $this->_document->getDMS()->getDB(); - if (!isset($this->_workflow)) { + if (!$this->_workflow) { $queryStr= "SELECT a.`id` as `wdcid`, a.`parent`, b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflows` b ON a.`workflow` = b.`id` WHERE a.`version`='".$this->_version ."' AND a.`document` = '". $this->_document->getID() ."' " @@ -6401,7 +6405,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ $this->getWorkflow(); - if (!isset($this->_workflow)) { + if (!$this->_workflow) { return true; } $workflow = $this->_workflow['workflow']; @@ -6444,7 +6448,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ $this->getWorkflow(); - if (!isset($this->_workflow)) { + if (!$this->_workflow) { return true; } @@ -6568,7 +6572,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if(!$this->_workflow) return false; - if (isset($this->_workflow)) { + if ($this->_workflow) { $workflow = $this->_workflow['workflow']; $db->startTransaction(); @@ -6580,7 +6584,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ /* Calling getWorkflow() should find the parent workflow, better check */ $parent = $this->_workflow['parent']; - unset($this->_workflow); + $this->_workflow = null; $this->getWorkflow(); if($this->_workflow['id'] != $parent) { $db->rollbackTransaction(); diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index b5f51db02..59887046a 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -12,7 +12,7 @@ uwe@steinmann.cx yes - 2021-12-11 + 2022-02-14 6.0.18 @@ -25,6 +25,7 @@ GPL License - all changes from 5.1.25 +- replace all checks on isset(_workflow) by checking for null