getWorkflowLog() will always return all log entries if document is not in a workflow

This commit is contained in:
Uwe Steinmann 2022-02-21 11:05:22 +01:00
parent 68bb7bcfaf
commit f095e252ad

View File

@ -6889,9 +6889,32 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
* Get the so far logged operations on the document content within the
* workflow. If the document content is currently in a workflow and
* a transition is passed, then the
* log entries will be restricted on the workflow and returned as one
* log entries will be restricted on the workflow and returned as a one
* dimensional list. Without a running workflow the log entries of
* all workflows in the past are returned grouped by workflow.
* This result is a two dimensional array. The keys of the first
* dimension are the ids used in table tblWorkflowDocumentContent.
* If only the logs of last workflow run are of interesst, then just
* take the last element of the returned array.
*
* Example: A workflow was started for a document content.
* This will add an entry in tblWorkflowDocumentContent whose state is set
* to the initial state of the workflow and a new autoinc id, e.g. with id 45
* Once any step in the workflow was triggered, the table tblWorkflowLog will
* have an entry for workflowdocumentcontent=45.
* Retrieving the workflow log as long the document is still in the workflow
* will return the log entries for the current workflow. In this particular
* case it will be an array with one log entry.
* Once the workflow has ended this method will still return the log entries
* but in a 2-dimensional array with the first dimension set to 45.
*
* The same document version can be run through the same or a different
* workflow again which will lead to a new entry in
* tblWorkflowDocumentContent, e.g. with id 46. Getting the log entries
* while the content is still in the workflow will return only those entries
* for the current workflow. Once the workflow has ended, this methods
* returns a 2-dimensional array with two elements in the first dimension.
* One for key 45 and another one for key 46.
*
* @return array list of objects
*/
@ -6918,7 +6941,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
$workflow = $this->_document->getDMS()->getWorkflow($resArr[$i]["workflow"]);
$workflowlog = new SeedDMS_Core_Workflow_Log($resArr[$i]["id"], $this->_document->getDMS()->getDocument($resArr[$i]["document"]), $resArr[$i]["version"], $workflow, $this->_document->getDMS()->getUser($resArr[$i]["userid"]), $workflow->getTransition($resArr[$i]["transition"]), $resArr[$i]["date"], $resArr[$i]["comment"]);
$workflowlog->setDMS($this);
if($this->_workflow && $transition)
if($this->_workflow)
$workflowlogs[] = $workflowlog;
else
$workflowlogs[$resArr[$i]["workflowdocumentcontent"]][] = $workflowlog;