replace checks isset(_workflow) with _workflow == null

This commit is contained in:
Uwe Steinmann 2022-02-14 11:06:02 +01:00
parent f93af56f52
commit b57dc78e2a
2 changed files with 12 additions and 7 deletions

View File

@ -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']; 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; $hasworkflow = $this->getWorkflow() ? true : false;
/* $pendingReview will be set when there are still open reviews */ /* $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 * $this->_workflow['parent']. $this->_workflow['id'] is the
* id from table tblWorkflowDocumentContent which is used to * id from table tblWorkflowDocumentContent which is used to
* get log entries for this workflow. * 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 * @return object/boolean an object of class SeedDMS_Core_Workflow
* or false in case of error, e.g. the version has not a 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() { /* {{{ */ function getWorkflow() { /* {{{ */
$db = $this->_document->getDMS()->getDB(); $db = $this->_document->getDMS()->getDB();
if (!isset($this->_workflow)) { if (!$this->_workflow) {
$queryStr= $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 "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() ."' " ."' AND a.`document` = '". $this->_document->getID() ."' "
@ -6401,7 +6405,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$this->getWorkflow(); $this->getWorkflow();
if (!isset($this->_workflow)) { if (!$this->_workflow) {
return true; return true;
} }
$workflow = $this->_workflow['workflow']; $workflow = $this->_workflow['workflow'];
@ -6444,7 +6448,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$this->getWorkflow(); $this->getWorkflow();
if (!isset($this->_workflow)) { if (!$this->_workflow) {
return true; return true;
} }
@ -6568,7 +6572,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
if(!$this->_workflow) if(!$this->_workflow)
return false; return false;
if (isset($this->_workflow)) { if ($this->_workflow) {
$workflow = $this->_workflow['workflow']; $workflow = $this->_workflow['workflow'];
$db->startTransaction(); $db->startTransaction();
@ -6580,7 +6584,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
/* Calling getWorkflow() should find the parent workflow, better check */ /* Calling getWorkflow() should find the parent workflow, better check */
$parent = $this->_workflow['parent']; $parent = $this->_workflow['parent'];
unset($this->_workflow); $this->_workflow = null;
$this->getWorkflow(); $this->getWorkflow();
if($this->_workflow['id'] != $parent) { if($this->_workflow['id'] != $parent) {
$db->rollbackTransaction(); $db->rollbackTransaction();

View File

@ -12,7 +12,7 @@
<email>uwe@steinmann.cx</email> <email>uwe@steinmann.cx</email>
<active>yes</active> <active>yes</active>
</lead> </lead>
<date>2021-12-11</date> <date>2022-02-14</date>
<time>13:44:55</time> <time>13:44:55</time>
<version> <version>
<release>6.0.18</release> <release>6.0.18</release>
@ -25,6 +25,7 @@
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license> <license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes> <notes>
- all changes from 5.1.25 - all changes from 5.1.25
- replace all checks on isset(_workflow) by checking for null
</notes> </notes>
<contents> <contents>
<dir baseinstalldir="SeedDMS" name="/"> <dir baseinstalldir="SeedDMS" name="/">