From 1534d2be8e3bd8182c8d8e71408a018a875e3c4b Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 17 Feb 2022 12:31:22 +0100 Subject: [PATCH 1/8] add target unittest --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 40a6ad44f..cc2deac8d 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,9 @@ dist: quickstart: vendor/bin/phing -Dversion=$(VERSION) package +unittest: + vendor/bin/phing -Dversion=$(VERSION) phpunitfast + pear: (cd SeedDMS_Core/; pear package) (cd SeedDMS_Lucene/; pear package) From cc5d7d1ecda2e077fa3d066fd5655ba03cb39901 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 18 Feb 2022 17:58:39 +0100 Subject: [PATCH 2/8] search for document by name in root folder if requested --- SeedDMS_Core/Core/inc.ClassDMS.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 76fec86ed..32cb15d70 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -768,6 +768,8 @@ class SeedDMS_Core_DMS { "WHERE `tblDocuments`.`name` = " . $this->db->qstr($name); if($folder) $queryStr .= " AND `tblDocuments`.`folder` = ". $folder->getID(); + if($this->checkWithinRootDir) + $queryStr .= " AND `tblDocuments`.`folderList` LIKE '%:".$this->rootFolderID.":%'"; $queryStr .= " ORDER BY `tblDocuments`.`id` DESC LIMIT 1"; $resArr = $this->db->getResultArray($queryStr); From d805de50359151d17954ed49575df7ade3d3761e Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 18 Feb 2022 18:00:07 +0100 Subject: [PATCH 3/8] setHomeFolder returns true on success --- SeedDMS_Core/Core/inc.ClassUser.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassUser.php b/SeedDMS_Core/Core/inc.ClassUser.php index e42a09e61..c655d333c 100644 --- a/SeedDMS_Core/Core/inc.ClassUser.php +++ b/SeedDMS_Core/Core/inc.ClassUser.php @@ -650,7 +650,6 @@ class SeedDMS_Core_User { /* {{{ */ $homefolder = intval($homefolder); $queryStr = "UPDATE `tblUsers` SET `homefolder` = " . ($homefolder ? $homefolder : 'NULL') . " WHERE `id` = " . $this->_id; - echo $queryStr; if (!$db->getResult($queryStr)) return false; @@ -1739,7 +1738,7 @@ class SeedDMS_Core_User { /* {{{ */ if (is_bool($resArr) && !$resArr) return false; } - return false; + return true; } /* }}} */ /** @@ -1775,7 +1774,7 @@ class SeedDMS_Core_User { /* {{{ */ if (is_bool($resArr) && !$resArr) return false; } - return false; + return true; } /* }}} */ /** @@ -1796,7 +1795,7 @@ class SeedDMS_Core_User { /* {{{ */ $resArr = $db->getResult($queryStr); if (is_bool($resArr) && !$resArr) return false; - return false; + return true; } /* }}} */ /** From d91787bf4428dcfa418629dc5c62583ba2bf3618 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 18 Feb 2022 18:00:50 +0100 Subject: [PATCH 4/8] check if !workflow instead of isset(workflow) --- SeedDMS_Core/Core/inc.ClassDocument.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index 1b0124134..d5e834f2c 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -3019,7 +3019,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if (!$ignorecurrentstatus && ($st["status"]==S_OBSOLETE || $st["status"]==S_REJECTED || $st["status"]==S_EXPIRED )) 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 */ @@ -4763,7 +4763,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 b.* FROM `tblWorkflowDocumentContent` a LEFT JOIN `tblWorkflows` b ON a.`workflow` = b.`id` WHERE a.`version`='".$this->_version ."' AND a.`document` = '". $this->_document->getID() ."' " @@ -4831,7 +4831,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ $this->getWorkflow(); - if (!isset($this->_workflow)) { + if (!$this->_workflow) { return true; } @@ -4872,7 +4872,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ $this->getWorkflow(); - if (!isset($this->_workflow)) { + if (!$this->_workflow) { return true; } @@ -4988,7 +4988,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ if(!$this->_workflow) return false; - if (isset($this->_workflow)) { + if ($this->_workflow) { $db->startTransaction(); $queryStr= From cffad48b6185781bbe2b38e00e8bba0cf592304d Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 18 Feb 2022 18:01:35 +0100 Subject: [PATCH 5/8] add method descrition for getWorkflowLog() --- SeedDMS_Core/Core/inc.ClassDocument.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index d5e834f2c..85c5c492e 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -5315,9 +5315,11 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ /** * Get the so far logged operations on the document content within the - * workflow + * workflow. Even after finishing the workflow (when the document content + * does not have workflow set anymore) this function returns the list of all + * log entries. * - * @return array list of operations + * @return array list of objects */ function getWorkflowLog($transition = null) { /* {{{ */ $db = $this->_document->getDMS()->getDB(); From ec1f99229e8f7e30803df8750f047025855a3b92 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 18 Feb 2022 18:02:08 +0100 Subject: [PATCH 6/8] rename getLastWorkflowTransition() to getLastWorkflowLow(), returns a log even after the workflow was ended --- SeedDMS_Core/Core/inc.ClassDocument.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index 85c5c492e..e19ab551d 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -5352,30 +5352,33 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ } /* }}} */ /** - * Get the latest logged transition for the document content within the - * workflow + * Get the latest workflow log entry for the document content within the + * workflow. Even after finishing the workflow (when the document content + * does not have workflow set anymore) this function returns the last + * log entry. * - * @return array list of operations + * @return object */ - function getLastWorkflowTransition() { /* {{{ */ + function getLastWorkflowLog() { /* {{{ */ $db = $this->_document->getDMS()->getDB(); +/* if(!$this->_workflow) $this->getWorkflow(); if(!$this->_workflow) return false; - + */ $queryStr= - "SELECT * FROM `tblWorkflowLog` WHERE `version`='".$this->_version ."' AND `document` = '". $this->_document->getID() ."' AND `workflow` = ". $this->_workflow->getID(); + "SELECT * FROM `tblWorkflowLog` WHERE `version`='".$this->_version ."' AND `document` = '". $this->_document->getID() ."'"; // AND `workflow` = ". $this->_workflow->getID(); $queryStr .= " ORDER BY `id` DESC LIMIT 1"; $resArr = $db->getResultArray($queryStr); if (is_bool($resArr) && !$resArr) return false; - $workflowlogs = array(); - $i = 0; - $workflowlog = new SeedDMS_Core_Workflow_Log($resArr[$i]["id"], $this->_document->getDMS()->getDocument($resArr[$i]["document"]), $resArr[$i]["version"], $this->_workflow, $this->_document->getDMS()->getUser($resArr[$i]["userid"]), $this->_workflow->getTransition($resArr[$i]["transition"]), $resArr[$i]["date"], $resArr[$i]["comment"]); + $i = 0; + $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); return $workflowlog; From b914fc3c9897be14a6d0061a3b54f7a5c03bfdd8 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 18 Feb 2022 18:04:33 +0100 Subject: [PATCH 7/8] add changes for 5.1.25 --- SeedDMS_Core/package.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index c54291d6f..6c0e63a0a 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -24,6 +24,8 @@ GPL License +- rename getLastWorkflowTransition() to getLastWorkflowLog() +- getLastWorkflowLog() returns a workflow entry even if the workflow has ended From 022fdc86b30c641b772f132ba0136c3600497196 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 18 Feb 2022 18:05:05 +0100 Subject: [PATCH 8/8] update release date --- SeedDMS_Core/package.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index 6c0e63a0a..99b3e8b92 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -12,7 +12,7 @@ uwe@steinmann.cx yes - 2021-12-11 + 2022-02-18 5.1.25